diff --git a/changelog.md b/changelog.md index 32d0679..936a79f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ # Change Log All notable changes to this project will be documented in this file. -## [0.3.9] - XXX +## [0.3.9] - 2024-04-22 ### Added - New methods in configuration-api v3.5, v3.6 for bot management: `create_bot_template`, `delete_bot_template`, `update_bot_template`, `list_bot_templates`, `issue_bot_token`, `reset_bot_secret`, `reset_bot_template_secret`. diff --git a/docs/agent/index.html b/docs/agent/index.html index 1bba542..eef8356 100644 --- a/docs/agent/index.html +++ b/docs/agent/index.html @@ -75,4 +75,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/rtm/api/index.html b/docs/agent/rtm/api/index.html index 7d6ac0a..026fc22 100644 --- a/docs/agent/rtm/api/index.html +++ b/docs/agent/rtm/api/index.html @@ -77,4 +77,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/rtm/api/v33.html b/docs/agent/rtm/api/v33.html index 8153ecb..af31d69 100644 --- a/docs/agent/rtm/api/v33.html +++ b/docs/agent/rtm/api/v33.html @@ -29,10 +29,10 @@

Module livechat.agent.rtm.api.v33

''' Module containing Agent RTM API client implementation for v3.3. '''
 
-from typing import Any, Optional
+from typing import Any, Optional, Union
 
 from livechat.utils.helpers import prepare_payload
-from livechat.utils.structures import RtmResponse
+from livechat.utils.structures import AccessToken, RtmResponse
 from livechat.utils.ws_client import WebsocketClient
 
 # pylint: disable=unused-argument, too-many-arguments, invalid-name, redefined-builtin
@@ -43,9 +43,26 @@ 

Module livechat.agent.rtm.api.v33

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.3/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -407,7 +424,11 @@

Module livechat.agent.rtm.api.v33

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts}) + return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + }) def send_rich_message_postback(self, chat_id: str = None, @@ -797,7 +818,7 @@

Module livechat.agent.rtm.api.v33

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -830,6 +851,8 @@

Module livechat.agent.rtm.api.v33

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1057,9 +1080,26 @@

Classes

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.3/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1421,7 +1461,11 @@

Classes

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts}) + return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + }) def send_rich_message_postback(self, chat_id: str = None, @@ -1811,7 +1855,7 @@

Classes

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -1844,6 +1888,8 @@

Classes

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -3036,7 +3082,7 @@

Returns

-def login(self, token: str = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

Logs in agent.

@@ -3079,7 +3125,7 @@

Returns

Expand source code
def login(self,
-          token: str = None,
+          token: Union[AccessToken, str] = None,
           timezone: str = None,
           reconnect: bool = None,
           push_notifications: dict = None,
@@ -3112,6 +3158,8 @@ 

Returns

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
@@ -3255,17 +3303,49 @@

Returns

-def open_connection(self) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None
-

Opens WebSocket connection.

+

Opens WebSocket connection.

+

Args

+
+
origin : dict
+
Specifies origin while creating websocket connection.
+
ping_timeout : int or float
+
timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
+
ping_interval : int or float
+
automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+
ws_conn_timeout : int or float
+
timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
+
+

keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

Expand source code -
def open_connection(self) -> None:
-    ''' Opens WebSocket connection. '''
-    self.ws.open()
+
def open_connection(self,
+                    origin: dict = None,
+                    ping_timeout: float = 3,
+                    ping_interval: float = 5,
+                    ws_conn_timeout: float = 10,
+                    keep_alive: bool = True) -> None:
+    ''' Opens WebSocket connection.
+
+        Args:
+            origin (dict): Specifies origin while creating websocket connection.
+            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
+                by default sets to 3 seconds.
+            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
+                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
+                by default sets to 10 seconds.
+            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
+    '''
+    self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
+                 keep_alive)
@@ -3476,7 +3556,11 @@

Returns

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts})
+ return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + })
@@ -4269,4 +4353,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/rtm/api/v34.html b/docs/agent/rtm/api/v34.html index 4f2538d..b75bde6 100644 --- a/docs/agent/rtm/api/v34.html +++ b/docs/agent/rtm/api/v34.html @@ -29,10 +29,10 @@

Module livechat.agent.rtm.api.v34

''' Module containing Agent RTM API client implementation for v3.4. '''
 
-from typing import Any, Optional
+from typing import Any, Optional, Union
 
 from livechat.utils.helpers import prepare_payload
-from livechat.utils.structures import RtmResponse
+from livechat.utils.structures import AccessToken, RtmResponse
 from livechat.utils.ws_client import WebsocketClient
 
 # pylint: disable=unused-argument, too-many-arguments, invalid-name, redefined-builtin
@@ -43,9 +43,26 @@ 

Module livechat.agent.rtm.api.v34

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.4/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -373,7 +390,11 @@

Module livechat.agent.rtm.api.v34

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts}) + return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + }) def send_rich_message_postback(self, chat_id: str = None, @@ -763,7 +784,7 @@

Module livechat.agent.rtm.api.v34

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -796,6 +817,8 @@

Module livechat.agent.rtm.api.v34

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1023,9 +1046,26 @@

Classes

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.4/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1353,7 +1393,11 @@

Classes

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts}) + return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + }) def send_rich_message_postback(self, chat_id: str = None, @@ -1743,7 +1787,7 @@

Classes

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -1776,6 +1820,8 @@

Classes

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -2933,7 +2979,7 @@

Returns

-def login(self, token: str = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

Logs in agent.

@@ -2976,7 +3022,7 @@

Returns

Expand source code
def login(self,
-          token: str = None,
+          token: Union[AccessToken, str] = None,
           timezone: str = None,
           reconnect: bool = None,
           push_notifications: dict = None,
@@ -3009,6 +3055,8 @@ 

Returns

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
@@ -3152,17 +3200,49 @@

Returns

-def open_connection(self) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None
-

Opens WebSocket connection.

+

Opens WebSocket connection.

+

Args

+
+
origin : dict
+
Specifies origin while creating websocket connection.
+
ping_timeout : int or float
+
timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
+
ping_interval : int or float
+
automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+
ws_conn_timeout : int or float
+
timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
+
+

keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

Expand source code -
def open_connection(self) -> None:
-    ''' Opens WebSocket connection. '''
-    self.ws.open()
+
def open_connection(self,
+                    origin: dict = None,
+                    ping_timeout: float = 3,
+                    ping_interval: float = 5,
+                    ws_conn_timeout: float = 10,
+                    keep_alive: bool = True) -> None:
+    ''' Opens WebSocket connection.
+
+        Args:
+            origin (dict): Specifies origin while creating websocket connection.
+            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
+                by default sets to 3 seconds.
+            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
+                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
+                by default sets to 10 seconds.
+            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
+    '''
+    self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
+                 keep_alive)
@@ -3330,7 +3410,11 @@

Returns

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts})
+ return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + })
@@ -4125,4 +4209,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/rtm/api/v35.html b/docs/agent/rtm/api/v35.html index aea502c..5eb2817 100644 --- a/docs/agent/rtm/api/v35.html +++ b/docs/agent/rtm/api/v35.html @@ -29,10 +29,10 @@

Module livechat.agent.rtm.api.v35

''' Module containing Agent RTM API client implementation for v3.5. '''
 
-from typing import Any, Optional
+from typing import Any, Optional, Union
 
 from livechat.utils.helpers import prepare_payload
-from livechat.utils.structures import RtmResponse
+from livechat.utils.structures import AccessToken, RtmResponse
 from livechat.utils.ws_client import WebsocketClient
 
 # pylint: disable=unused-argument, too-many-arguments, invalid-name, redefined-builtin
@@ -43,9 +43,26 @@ 

Module livechat.agent.rtm.api.v35

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.5/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -373,7 +390,11 @@

Module livechat.agent.rtm.api.v35

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts}) + return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + }) def send_rich_message_postback(self, chat_id: str = None, @@ -763,7 +784,7 @@

Module livechat.agent.rtm.api.v35

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -796,6 +817,8 @@

Module livechat.agent.rtm.api.v35

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1023,9 +1046,26 @@

Classes

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.5/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1353,7 +1393,11 @@

Classes

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts}) + return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + }) def send_rich_message_postback(self, chat_id: str = None, @@ -1743,7 +1787,7 @@

Classes

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -1776,6 +1820,8 @@

Classes

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -2933,7 +2979,7 @@

Returns

-def login(self, token: str = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

Logs in agent.

@@ -2976,7 +3022,7 @@

Returns

Expand source code
def login(self,
-          token: str = None,
+          token: Union[AccessToken, str] = None,
           timezone: str = None,
           reconnect: bool = None,
           push_notifications: dict = None,
@@ -3009,6 +3055,8 @@ 

Returns

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
@@ -3152,17 +3200,49 @@

Returns

-def open_connection(self) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None
-

Opens WebSocket connection.

+

Opens WebSocket connection.

+

Args

+
+
origin : dict
+
Specifies origin while creating websocket connection.
+
ping_timeout : int or float
+
timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
+
ping_interval : int or float
+
automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+
ws_conn_timeout : int or float
+
timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
+
+

keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

Expand source code -
def open_connection(self) -> None:
-    ''' Opens WebSocket connection. '''
-    self.ws.open()
+
def open_connection(self,
+                    origin: dict = None,
+                    ping_timeout: float = 3,
+                    ping_interval: float = 5,
+                    ws_conn_timeout: float = 10,
+                    keep_alive: bool = True) -> None:
+    ''' Opens WebSocket connection.
+
+        Args:
+            origin (dict): Specifies origin while creating websocket connection.
+            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
+                by default sets to 3 seconds.
+            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
+                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
+                by default sets to 10 seconds.
+            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
+    '''
+    self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
+                 keep_alive)
@@ -3330,7 +3410,11 @@

Returns

opts['author_id'] = author_id if payload is None: payload = prepare_payload(locals()) - return self.ws.send({'action': 'send_event', 'payload': payload, **opts})
+ return self.ws.send({ + 'action': 'send_event', + 'payload': payload, + **opts + })
@@ -4125,4 +4209,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/rtm/api/v36.html b/docs/agent/rtm/api/v36.html index bfb4469..3b1457f 100644 --- a/docs/agent/rtm/api/v36.html +++ b/docs/agent/rtm/api/v36.html @@ -29,10 +29,10 @@

Module livechat.agent.rtm.api.v36

''' Module containing Agent RTM API client implementation for v3.6. '''
 
-from typing import Any, Optional
+from typing import Any, Optional, Union
 
 from livechat.utils.helpers import prepare_payload
-from livechat.utils.structures import RtmResponse
+from livechat.utils.structures import AccessToken, RtmResponse
 from livechat.utils.ws_client import WebsocketClient
 
 # pylint: disable=unused-argument, too-many-arguments, invalid-name, redefined-builtin
@@ -43,9 +43,26 @@ 

Module livechat.agent.rtm.api.v36

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.6/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -739,7 +756,7 @@

Module livechat.agent.rtm.api.v36

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -772,6 +789,8 @@

Module livechat.agent.rtm.api.v36

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1001,9 +1020,26 @@

Classes

def __init__(self, url: str): self.ws = WebsocketClient(url=f'wss://{url}/v3.6/agent/rtm/ws') - def open_connection(self) -> None: - ''' Opens WebSocket connection. ''' - self.ws.open() + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: + ''' Opens WebSocket connection. + + Args: + origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. + ''' + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1697,7 +1733,7 @@

Classes

# Status def login(self, - token: str = None, + token: Union[AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, @@ -1730,6 +1766,8 @@

Classes

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -2827,7 +2865,7 @@

Returns

-def login(self, token: str = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str] = None, timezone: str = None, reconnect: bool = None, push_notifications: dict = None, application: dict = None, away: bool = None, customer_monitoring_level: str = None, pushes: dict = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

Logs in agent.

@@ -2870,7 +2908,7 @@

Returns

Expand source code
def login(self,
-          token: str = None,
+          token: Union[AccessToken, str] = None,
           timezone: str = None,
           reconnect: bool = None,
           push_notifications: dict = None,
@@ -2903,6 +2941,8 @@ 

Returns

RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
@@ -3050,17 +3090,49 @@

Returns

-def open_connection(self) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None
-

Opens WebSocket connection.

+

Opens WebSocket connection.

+

Args

+
+
origin : dict
+
Specifies origin while creating websocket connection.
+
ping_timeout : int or float
+
timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
+
ping_interval : int or float
+
automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+
ws_conn_timeout : int or float
+
timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
+
+

keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

Expand source code -
def open_connection(self) -> None:
-    ''' Opens WebSocket connection. '''
-    self.ws.open()
+
def open_connection(self,
+                    origin: dict = None,
+                    ping_timeout: float = 3,
+                    ping_interval: float = 5,
+                    ws_conn_timeout: float = 10,
+                    keep_alive: bool = True) -> None:
+    ''' Opens WebSocket connection.
+
+        Args:
+            origin (dict): Specifies origin while creating websocket connection.
+            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
+                by default sets to 3 seconds.
+            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
+                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
+            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
+                by default sets to 10 seconds.
+            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
+    '''
+    self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
+                 keep_alive)
@@ -4026,4 +4098,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/rtm/base.html b/docs/agent/rtm/base.html index 3ab3ed3..be88dbb 100644 --- a/docs/agent/rtm/base.html +++ b/docs/agent/rtm/base.html @@ -50,7 +50,7 @@

Module livechat.agent.rtm.base

def get_client( version: str = stable_version, base_url: str = api_url - ) -> Union[AgentRtmV33, AgentRtmV34, AgentRtmV35]: + ) -> Union[AgentRtmV33, AgentRtmV34, AgentRtmV35, AgentRtmV36]: ''' Returns client for specific Agent RTM version. Args: @@ -98,7 +98,7 @@

Classes

def get_client( version: str = stable_version, base_url: str = api_url - ) -> Union[AgentRtmV33, AgentRtmV34, AgentRtmV35]: + ) -> Union[AgentRtmV33, AgentRtmV34, AgentRtmV35, AgentRtmV36]: ''' Returns client for specific Agent RTM version. Args: @@ -124,7 +124,7 @@

Classes

Static methods

-def get_client(version: str = '3.5', base_url: str = 'api.livechatinc.com') ‑> Union[AgentRtmV33AgentRtmV34AgentRtmV35] +def get_client(version: str = '3.5', base_url: str = 'api.livechatinc.com') ‑> Union[AgentRtmV33AgentRtmV34AgentRtmV35AgentRtmV36]

Returns client for specific Agent RTM version.

@@ -150,7 +150,7 @@

Raises

def get_client( version: str = stable_version, base_url: str = api_url -) -> Union[AgentRtmV33, AgentRtmV34, AgentRtmV35]: +) -> Union[AgentRtmV33, AgentRtmV34, AgentRtmV35, AgentRtmV36]: ''' Returns client for specific Agent RTM version. Args: @@ -207,4 +207,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/rtm/index.html b/docs/agent/rtm/index.html index 0042e99..838bca8 100644 --- a/docs/agent/rtm/index.html +++ b/docs/agent/rtm/index.html @@ -67,4 +67,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/web/api/index.html b/docs/agent/web/api/index.html index c6a3877..fe5f169 100644 --- a/docs/agent/web/api/index.html +++ b/docs/agent/web/api/index.html @@ -77,4 +77,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/web/api/v33.html b/docs/agent/web/api/v33.html index c27749c..49da139 100644 --- a/docs/agent/web/api/v33.html +++ b/docs/agent/web/api/v33.html @@ -38,19 +38,21 @@

Module livechat.agent.web.api.v33

from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken class AgentWebV33(HttpClient): ''' Agent Web API Class containing methods in version 3.3. ''' def __init__(self, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) self.api_url = f'https://{base_url}/v3.3/agent/action' # Chats @@ -1149,7 +1151,7 @@

Classes

class AgentWebV33 -(access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Agent Web API Class containing methods in version 3.3.

@@ -1160,14 +1162,15 @@

Classes

class AgentWebV33(HttpClient):
     ''' Agent Web API Class containing methods in version 3.3. '''
     def __init__(self,
-                 access_token: str,
+                 access_token: typing.Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(access_token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.3/agent/action'
 
     # Chats
@@ -4628,4 +4631,4 @@ 

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/web/api/v34.html b/docs/agent/web/api/v34.html index f64559b..3965746 100644 --- a/docs/agent/web/api/v34.html +++ b/docs/agent/web/api/v34.html @@ -38,6 +38,7 @@

Module livechat.agent.web.api.v34

from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken # pylint: disable=R0903 @@ -45,14 +46,15 @@

Module livechat.agent.web.api.v34

class AgentWebV34(HttpClient): ''' Agent Web API Class containing methods in version 3.4. ''' def __init__(self, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) self.api_url = f'https://{base_url}/v3.4/agent/action' # Chats @@ -1111,7 +1113,7 @@

Classes

class AgentWebV34 -(access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Agent Web API Class containing methods in version 3.4.

@@ -1122,14 +1124,15 @@

Classes

class AgentWebV34(HttpClient):
     ''' Agent Web API Class containing methods in version 3.4. '''
     def __init__(self,
-                 access_token: str,
+                 access_token: typing.Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(access_token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.4/agent/action'
 
     # Chats
@@ -4460,4 +4463,4 @@ 

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/web/api/v35.html b/docs/agent/web/api/v35.html index 91c0049..2872372 100644 --- a/docs/agent/web/api/v35.html +++ b/docs/agent/web/api/v35.html @@ -38,6 +38,7 @@

Module livechat.agent.web.api.v35

from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken # pylint: disable=R0903 @@ -45,14 +46,15 @@

Module livechat.agent.web.api.v35

class AgentWebV35(HttpClient): ''' Agent Web API Class containing methods in version 3.5. ''' def __init__(self, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) self.api_url = f'https://{base_url}/v3.5/agent/action' # Chats @@ -1111,7 +1113,7 @@

Classes

class AgentWebV35 -(access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Agent Web API Class containing methods in version 3.5.

@@ -1122,14 +1124,15 @@

Classes

class AgentWebV35(HttpClient):
     ''' Agent Web API Class containing methods in version 3.5. '''
     def __init__(self,
-                 access_token: str,
+                 access_token: typing.Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(access_token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.5/agent/action'
 
     # Chats
@@ -4460,4 +4463,4 @@ 

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/web/api/v36.html b/docs/agent/web/api/v36.html index 4218f1d..7f5b8b1 100644 --- a/docs/agent/web/api/v36.html +++ b/docs/agent/web/api/v36.html @@ -38,6 +38,7 @@

Module livechat.agent.web.api.v36

from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken # pylint: disable=R0903 @@ -45,14 +46,15 @@

Module livechat.agent.web.api.v36

class AgentWebV36(HttpClient): ''' Agent Web API Class containing methods in version 3.6. ''' def __init__(self, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) self.api_url = f'https://{base_url}/v3.6/agent/action' # Chats @@ -1099,7 +1101,7 @@

Classes

class AgentWebV36 -(access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Agent Web API Class containing methods in version 3.6.

@@ -1110,14 +1112,15 @@

Classes

class AgentWebV36(HttpClient):
     ''' Agent Web API Class containing methods in version 3.6. '''
     def __init__(self,
-                 access_token: str,
+                 access_token: typing.Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(access_token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.6/agent/action'
 
     # Chats
@@ -4413,4 +4416,4 @@ 

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/web/base.html b/docs/agent/web/base.html index 3a60bbb..6dfc6eb 100644 --- a/docs/agent/web/base.html +++ b/docs/agent/web/base.html @@ -34,11 +34,14 @@

Module livechat.agent.web.base

from typing import Union +import httpx + from livechat.agent.web.api.v33 import AgentWebV33 from livechat.agent.web.api.v34 import AgentWebV34 from livechat.agent.web.api.v35 import AgentWebV35 from livechat.agent.web.api.v36 import AgentWebV36 from livechat.config import CONFIG +from livechat.utils.structures import AccessToken stable_version = CONFIG.get('stable') api_url = CONFIG.get('url') @@ -49,14 +52,15 @@

Module livechat.agent.web.base

API version. ''' @staticmethod def get_client( - access_token: str, + access_token: Union[AccessToken, str], version: str = stable_version, base_url: str = api_url, http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, - ) -> Union[AgentWebV33, AgentWebV34, AgentWebV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[AgentWebV33, AgentWebV34, AgentWebV35, AgentWebV36]: ''' Returns client for specific API version. Args: @@ -72,6 +76,8 @@

Module livechat.agent.web.base

a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: API client object for specified version. @@ -82,16 +88,16 @@

Module livechat.agent.web.base

client = { '3.3': AgentWebV33(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': AgentWebV34(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': AgentWebV35(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': AgentWebV36(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -122,14 +128,15 @@

Classes

API version. ''' @staticmethod def get_client( - access_token: str, + access_token: Union[AccessToken, str], version: str = stable_version, base_url: str = api_url, http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, - ) -> Union[AgentWebV33, AgentWebV34, AgentWebV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[AgentWebV33, AgentWebV34, AgentWebV35, AgentWebV36]: ''' Returns client for specific API version. Args: @@ -145,6 +152,8 @@

Classes

a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: API client object for specified version. @@ -155,16 +164,16 @@

Classes

client = { '3.3': AgentWebV33(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': AgentWebV34(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': AgentWebV35(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': AgentWebV36(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -173,7 +182,7 @@

Classes

Static methods

-def get_client(access_token: str, version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False) ‑> Union[AgentWebV33AgentWebV34AgentWebV35] +def get_client(access_token: Union[AccessToken, str], version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15)) ‑> Union[AgentWebV33AgentWebV34AgentWebV35AgentWebV36]

Returns client for specific API version.

@@ -198,6 +207,9 @@

Args

(which will disable verification). Defaults to True.
disable_logging : bool
indicates if logging should be disabled.
+
timeout : float
+
The timeout configuration to use when sending requests. +Defaults to 15 seconds.

Returns

API client object for specified version.

@@ -212,14 +224,15 @@

Raises

@staticmethod
 def get_client(
-    access_token: str,
+    access_token: Union[AccessToken, str],
     version: str = stable_version,
     base_url: str = api_url,
     http2: bool = False,
     proxies: dict = None,
     verify: bool = True,
     disable_logging: bool = False,
-) -> Union[AgentWebV33, AgentWebV34, AgentWebV35]:
+    timeout: float = httpx.Timeout(15)
+) -> Union[AgentWebV33, AgentWebV34, AgentWebV35, AgentWebV36]:
     ''' Returns client for specific API version.
 
         Args:
@@ -235,6 +248,8 @@ 

Raises

a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: API client object for specified version. @@ -245,16 +260,16 @@

Raises

client = { '3.3': AgentWebV33(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': AgentWebV34(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': AgentWebV35(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': AgentWebV36(access_token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -294,4 +309,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/agent/web/index.html b/docs/agent/web/index.html index f3442be..16e7447 100644 --- a/docs/agent/web/index.html +++ b/docs/agent/web/index.html @@ -67,4 +67,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/billing/api/index.html b/docs/billing/api/index.html index fa98fb4..d8a201a 100644 --- a/docs/billing/api/index.html +++ b/docs/billing/api/index.html @@ -69,4 +69,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/billing/api/v1.html b/docs/billing/api/v1.html index f0835c1..bc27ace 100644 --- a/docs/billing/api/v1.html +++ b/docs/billing/api/v1.html @@ -43,9 +43,10 @@

Module livechat.billing.api.v1

http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): super().__init__(token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) self.api_url = f'https://{base_url}/v1' # direct_charge @@ -393,7 +394,7 @@

Classes

class BillingApiV1 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Billing API client class in version 1.

@@ -409,9 +410,10 @@

Classes

http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): super().__init__(token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) self.api_url = f'https://{base_url}/v1' # direct_charge @@ -1516,4 +1518,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/billing/base.html b/docs/billing/base.html index 4cb60ef..a305c00 100644 --- a/docs/billing/base.html +++ b/docs/billing/base.html @@ -36,6 +36,8 @@

Module livechat.billing.base

from __future__ import annotations +import httpx + from livechat.config import CONFIG from .api import BillingApiV1 @@ -56,6 +58,7 @@

Module livechat.billing.base

proxies: dict = None, verify: bool = True, disable_logging: bool = False, + timeout: float = httpx.Timeout(15) ) -> BillingApiV1: ''' Returns client for specific Billing API version. @@ -72,6 +75,8 @@

Module livechat.billing.base

a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: BillingApi: API client object for specified version. @@ -82,7 +87,7 @@

Module livechat.billing.base

client = { '1': BillingApiV1(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -120,6 +125,7 @@

Classes

proxies: dict = None, verify: bool = True, disable_logging: bool = False, + timeout: float = httpx.Timeout(15) ) -> BillingApiV1: ''' Returns client for specific Billing API version. @@ -136,6 +142,8 @@

Classes

a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: BillingApi: API client object for specified version. @@ -146,7 +154,7 @@

Classes

client = { '1': BillingApiV1(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -155,7 +163,7 @@

Classes

Static methods

-def get_client(token: str, version: str = '1', base_url: str = 'billing.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False) ‑> BillingApiV1 +def get_client(token: str, version: str = '1', base_url: str = 'billing.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15)) ‑> BillingApiV1

Returns client for specific Billing API version.

@@ -180,6 +188,9 @@

Args

(which will disable verification). Defaults to True.
disable_logging : bool
indicates if logging should be disabled.
+
timeout : float
+
The timeout configuration to use when sending requests. +Defaults to 15 seconds.

Returns

@@ -204,6 +215,7 @@

Raises

proxies: dict = None, verify: bool = True, disable_logging: bool = False, + timeout: float = httpx.Timeout(15) ) -> BillingApiV1: ''' Returns client for specific Billing API version. @@ -220,6 +232,8 @@

Raises

a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: BillingApi: API client object for specified version. @@ -230,7 +244,7 @@

Raises

client = { '1': BillingApiV1(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -270,4 +284,4 @@

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/billing/index.html b/docs/billing/index.html index ed3a676..49c3c0d 100644 --- a/docs/billing/index.html +++ b/docs/billing/index.html @@ -75,4 +75,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/configuration/api/index.html b/docs/configuration/api/index.html index 62e3a3a..b8875bc 100644 --- a/docs/configuration/api/index.html +++ b/docs/configuration/api/index.html @@ -77,4 +77,4 @@

Index

Generated by pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/configuration/api/v33.html b/docs/configuration/api/v33.html index 08eba41..b650100 100644 --- a/docs/configuration/api/v33.html +++ b/docs/configuration/api/v33.html @@ -29,23 +29,27 @@

Module livechat.configuration.api.v33

''' Configuration API module with client class in version 3.3. '''
 
+from typing import Union
+
 import httpx
 
 from livechat.utils.helpers import prepare_payload
 from livechat.utils.http_client import HttpClient
+from livechat.utils.structures import AccessToken
 
 
 class ConfigurationApiV33(HttpClient):
     ''' Configuration API client class in version 3.3. '''
     def __init__(self,
-                 token: str,
+                 token: Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.3/configuration/action'
 
 # Agents
@@ -1239,7 +1243,7 @@ 

Classes

class ConfigurationApiV33 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Configuration API client class in version 3.3.

@@ -1250,14 +1254,15 @@

Classes

class ConfigurationApiV33(HttpClient):
     ''' Configuration API client class in version 3.3. '''
     def __init__(self,
-                 token: str,
+                 token: Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.3/configuration/action'
 
 # Agents
@@ -5015,4 +5020,4 @@ 

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/configuration/api/v34.html b/docs/configuration/api/v34.html index bbab5e8..0d3690b 100644 --- a/docs/configuration/api/v34.html +++ b/docs/configuration/api/v34.html @@ -29,23 +29,27 @@

Module livechat.configuration.api.v34

''' Configuration API module with client class in version 3.4. '''
 
+from typing import Union
+
 import httpx
 
 from livechat.utils.helpers import prepare_payload
 from livechat.utils.http_client import HttpClient
+from livechat.utils.structures import AccessToken
 
 
 class ConfigurationApiV34(HttpClient):
     ''' Configuration API client class in version 3.4. '''
     def __init__(self,
-                 token: str,
+                 token: Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.4/configuration/action'
 
 # Agents
@@ -1240,7 +1244,7 @@ 

Classes

class ConfigurationApiV34 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Configuration API client class in version 3.4.

@@ -1251,14 +1255,15 @@

Classes

class ConfigurationApiV34(HttpClient):
     ''' Configuration API client class in version 3.4. '''
     def __init__(self,
-                 token: str,
+                 token: Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.4/configuration/action'
 
 # Agents
@@ -5018,4 +5023,4 @@ 

pdoc 0.10.0.

- + \ No newline at end of file diff --git a/docs/configuration/api/v35.html b/docs/configuration/api/v35.html index b6704fc..3f7759b 100644 --- a/docs/configuration/api/v35.html +++ b/docs/configuration/api/v35.html @@ -29,25 +29,27 @@

Module livechat.configuration.api.v35

''' Configuration API module with client class in version 3.5. '''
 
-from typing import List
+from typing import List, Union
 
 import httpx
 
 from livechat.utils.helpers import prepare_payload
 from livechat.utils.http_client import HttpClient
+from livechat.utils.structures import AccessToken
 
 
 class ConfigurationApiV35(HttpClient):
     ''' Configuration API client class in version 3.5. '''
     def __init__(self,
-                 token: str,
+                 token: Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.5/configuration/action'
 
 # Agents
@@ -464,6 +466,48 @@ 

Module livechat.configuration.api.v35

json=payload, headers=headers) + def create_bot_template(self, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + job_title: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Creates a new bot template for the Client ID (application) provided in the request. + One Client ID can register up to five bot templates. + Bots based on the template will be automatically created on the license when the application is installed. + The bots will have the same ID as the bot template. If the application is already installed on the license, + the bots will be created only if `affect_existing_installations` is set to `true`. + Args: + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6. + default_group_priority (str): The default routing priority for a group without defined priority. + job_title (str): Bot's job title. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/create_bot_template', + json=payload, + headers=headers) + def delete_bot(self, id: str = None, payload: dict = None, @@ -488,6 +532,39 @@

Module livechat.configuration.api.v35

json=payload, headers=headers) + def delete_bot_template(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Deletes a bot template specified by `id`. The bots associated with the template will + be deleted only if `affect_existing_installations` is set to `true`. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/delete_bot_template', + json=payload, + headers=headers) + def update_bot(self, id: str = None, name: str = None, @@ -526,6 +603,46 @@

Module livechat.configuration.api.v35

json=payload, headers=headers) + def update_bot_template(self, + id: str = None, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Updates an existing Bot Template. + + Args: + id (str): Bot Template ID. + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot. + default_group_priority (str): The default routing priority for a group without defined priority. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/update_bot_template', + json=payload, + headers=headers) + def list_bots(self, all: bool = None, fields: list = None, @@ -552,6 +669,32 @@

Module livechat.configuration.api.v35

json=payload, headers=headers) + def list_bot_templates(self, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Returns the list of Bot Templates created for the Client ID (application). + + Args: + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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_bot_templates', + json=payload, + headers=headers) + def get_bot(self, id: str = None, fields: list = None, @@ -578,6 +721,96 @@

Module livechat.configuration.api.v35

json=payload, headers=headers) + def issue_bot_token(self, + bot_id: str = None, + bot_secret: str = None, + organization_id: str = None, + client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked. + + Args: + bot_id (str): Bot's ID. + bot_secret (str): Bot's secret. + organization_id (str): Organization's ID. + client_id (str): Client's ID. + 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}/issue_bot_token', + json=payload, + headers=headers) + + def reset_bot_secret(self, + id: str = None, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot. + + Args: + id (str): Bot's ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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}/reset_bot_secret', + json=payload, + headers=headers) + + def reset_bot_template_secret(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot template. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/reset_bot_template_secret', + json=payload, + headers=headers) + # Groups def create_group(self, @@ -1527,7 +1760,7 @@

Classes

class ConfigurationApiV35 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

Configuration API client class in version 3.5.

@@ -1538,14 +1771,15 @@

Classes

class ConfigurationApiV35(HttpClient):
     ''' Configuration API client class in version 3.5. '''
     def __init__(self,
-                 token: str,
+                 token: Union[AccessToken, str],
                  base_url: str,
                  http2: bool,
                  proxies=None,
                  verify: bool = True,
-                 disable_logging: bool = False):
+                 disable_logging: bool = False,
+                 timeout: float = httpx.Timeout(15)):
         super().__init__(token, base_url, http2, proxies, verify,
-                         disable_logging)
+                         disable_logging, timeout)
         self.api_url = f'https://{base_url}/v3.5/configuration/action'
 
 # Agents
@@ -1962,6 +2196,48 @@ 

Classes

json=payload, headers=headers) + def create_bot_template(self, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + job_title: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Creates a new bot template for the Client ID (application) provided in the request. + One Client ID can register up to five bot templates. + Bots based on the template will be automatically created on the license when the application is installed. + The bots will have the same ID as the bot template. If the application is already installed on the license, + the bots will be created only if `affect_existing_installations` is set to `true`. + Args: + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6. + default_group_priority (str): The default routing priority for a group without defined priority. + job_title (str): Bot's job title. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/create_bot_template', + json=payload, + headers=headers) + def delete_bot(self, id: str = None, payload: dict = None, @@ -1986,6 +2262,39 @@

Classes

json=payload, headers=headers) + def delete_bot_template(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Deletes a bot template specified by `id`. The bots associated with the template will + be deleted only if `affect_existing_installations` is set to `true`. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/delete_bot_template', + json=payload, + headers=headers) + def update_bot(self, id: str = None, name: str = None, @@ -2024,6 +2333,46 @@

Classes

json=payload, headers=headers) + def update_bot_template(self, + id: str = None, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Updates an existing Bot Template. + + Args: + id (str): Bot Template ID. + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot. + default_group_priority (str): The default routing priority for a group without defined priority. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/update_bot_template', + json=payload, + headers=headers) + def list_bots(self, all: bool = None, fields: list = None, @@ -2050,6 +2399,32 @@

Classes

json=payload, headers=headers) + def list_bot_templates(self, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Returns the list of Bot Templates created for the Client ID (application). + + Args: + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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_bot_templates', + json=payload, + headers=headers) + def get_bot(self, id: str = None, fields: list = None, @@ -2076,6 +2451,96 @@

Classes

json=payload, headers=headers) + def issue_bot_token(self, + bot_id: str = None, + bot_secret: str = None, + organization_id: str = None, + client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked. + + Args: + bot_id (str): Bot's ID. + bot_secret (str): Bot's secret. + organization_id (str): Organization's ID. + client_id (str): Client's ID. + 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}/issue_bot_token', + json=payload, + headers=headers) + + def reset_bot_secret(self, + id: str = None, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot. + + Args: + id (str): Bot's ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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}/reset_bot_secret', + json=payload, + headers=headers) + + def reset_bot_template_secret(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot template. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/reset_bot_template_secret', + json=payload, + headers=headers) + # Groups def create_group(self, @@ -3732,6 +4197,96 @@

Returns

headers=headers)
+
+def create_bot_template(self, name: str = None, avatar: str = None, max_chats_count: int = None, default_group_priority: str = None, job_title: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Creates a new bot template for the Client ID (application) provided in the request. +One Client ID can register up to five bot templates. +Bots based on the template will be automatically created on the license when the application is installed. +The bots will have the same ID as the bot template. If the application is already installed on the license, +the bots will be created only if affect_existing_installations is set to true.

+

Args

+
+
name : str
+
Display name.
+
avatar : str
+
Avatar URL.
+
max_chats_count : int
+
Max. number of incoming chats that can be routed to the Bot; default: 6.
+
default_group_priority : str
+
The default routing priority for a group without defined priority.
+
job_title : str
+
Bot's job title.
+
owner_client_id : str
+
Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
+
affect_existing_installations : bool
+
based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
+
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.
+
+
+ +Expand source code + +
def create_bot_template(self,
+                        name: str = None,
+                        avatar: str = None,
+                        max_chats_count: int = None,
+                        default_group_priority: str = None,
+                        job_title: str = None,
+                        owner_client_id: str = None,
+                        affect_existing_installations: bool = None,
+                        payload: dict = None,
+                        headers: dict = None) -> httpx.Response:
+    ''' Creates a new bot template for the Client ID (application) provided in the request.
+        One Client ID can register up to five bot templates.
+        Bots based on the template will be automatically created on the license when the application is installed.
+        The bots will have the same ID as the bot template. If the application is already installed on the license,
+        the bots will be created only if `affect_existing_installations` is set to `true`.
+        Args:
+            name (str): Display name.
+            avatar (str): Avatar URL.
+            max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6.
+            default_group_priority (str): The default routing priority for a group without defined priority.
+            job_title (str): Bot's job title.
+            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
+                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
+                                   will be ignored, and provided `owner_client_id` will be used instead.
+            affect_existing_installations (bool): based on this template will be created on all licenses that have given
+                                                  application installed. Otherwise only new installations will trigger bot
+                                                  creation.
+            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}/create_bot_template',
+                             json=payload,
+                             headers=headers)
+
+
def create_group(self, name: str = None, language_code: str = None, agent_priorities: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
@@ -3947,20 +4502,81 @@

Returns

''' if payload is None: payload = prepare_payload(locals()) - return self.session.post(f'{self.api_url}/delete_auto_access', + return self.session.post(f'{self.api_url}/delete_auto_access', + json=payload, + headers=headers)
+ +

+
+def delete_bot(self, id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Deletes a Bot.

+

Args

+
+
id : str
+
Bot's ID.
+
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.
+
+
+ +Expand source code + +
def delete_bot(self,
+               id: str = None,
+               payload: dict = None,
+               headers: dict = None) -> httpx.Response:
+    ''' Deletes a Bot.
+
+        Args:
+            id (str): Bot's ID.
+            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}/delete_bot',
                              json=payload,
                              headers=headers)
-
-def delete_bot(self, id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+def delete_bot_template(self, id: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
-

Deletes a Bot.

+

Deletes a bot template specified by id. The bots associated with the template will +be deleted only if affect_existing_installations is set to true.

Args

id : str
-
Bot's ID.
+
Bot Template ID.
+
owner_client_id : str
+
Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
+
affect_existing_installations : bool
+
based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
payload : dict
Custom payload to be used as request's data. It overrides all other parameters provided for the method.
@@ -3979,14 +4595,23 @@

Returns

Expand source code -
def delete_bot(self,
-               id: str = None,
-               payload: dict = None,
-               headers: dict = None) -> httpx.Response:
-    ''' Deletes a Bot.
+
def delete_bot_template(self,
+                        id: str = None,
+                        owner_client_id: str = None,
+                        affect_existing_installations: bool = None,
+                        payload: dict = None,
+                        headers: dict = None) -> httpx.Response:
+    ''' Deletes a bot template specified by `id`. The bots associated with the template will
+        be deleted only if `affect_existing_installations` is set to `true`.
 
         Args:
-            id (str): Bot's ID.
+            id (str): Bot Template ID.
+            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
+                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
+                                   will be ignored, and provided `owner_client_id` will be used instead.
+            affect_existing_installations (bool): based on this template will be created on all licenses that have given
+                                                  application installed. Otherwise only new installations will trigger bot
+                                                  creation.
             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.
@@ -3999,7 +4624,7 @@ 

Returns

''' if payload is None: payload = prepare_payload(locals()) - return self.session.post(f'{self.api_url}/delete_bot', + return self.session.post(f'{self.api_url}/delete_bot_template', json=payload, headers=headers)
@@ -4590,6 +5215,70 @@

Returns

headers=headers)
+
+def issue_bot_token(self, bot_id: str = None, bot_secret: str = None, organization_id: str = None, client_id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked.

+

Args

+
+
bot_id : str
+
Bot's ID.
+
bot_secret : str
+
Bot's secret.
+
organization_id : str
+
Organization's ID.
+
client_id : str
+
Client's ID.
+
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.
+
+
+ +Expand source code + +
def issue_bot_token(self,
+                    bot_id: str = None,
+                    bot_secret: str = None,
+                    organization_id: str = None,
+                    client_id: str = None,
+                    payload: dict = None,
+                    headers: dict = None) -> httpx.Response:
+    ''' Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked.
+
+        Args:
+            bot_id (str): Bot's ID.
+            bot_secret (str): Bot's secret.
+            organization_id (str): Organization's ID.
+            client_id (str): Client's ID.
+            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}/issue_bot_token',
+                             json=payload,
+                             headers=headers)
+
+
def list_agents(self, filters: dict = None, fields: list = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
@@ -4691,6 +5380,62 @@

Args

headers=headers)

+
+def list_bot_templates(self, owner_client_id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Returns the list of Bot Templates created for the Client ID (application).

+

Args

+
+
owner_client_id : str
+
Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
+
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.
+
+
+ +Expand source code + +
def list_bot_templates(self,
+                       owner_client_id: str = None,
+                       payload: dict = None,
+                       headers: dict = None) -> httpx.Response:
+    ''' Returns the list of Bot Templates created for the Client ID (application).
+
+        Args:
+            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
+                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
+                                   will be ignored, and provided `owner_client_id` will be used instead.
+            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_bot_templates',
+                             json=payload,
+                             headers=headers)
+
+
def list_bots(self, all: bool = None, fields: list = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
@@ -5438,6 +6183,134 @@

Returns

headers=headers)

+
+def reset_bot_secret(self, id: str = None, owner_client_id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Resets secret for given bot.

+

Args

+
+
id : str
+
Bot's ID.
+
owner_client_id : str
+
Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
+
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.
+
+
+ +Expand source code + +
def reset_bot_secret(self,
+                     id: str = None,
+                     owner_client_id: str = None,
+                     payload: dict = None,
+                     headers: dict = None) -> httpx.Response:
+    ''' Resets secret for given bot.
+
+        Args:
+            id (str): Bot's ID.
+            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
+                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
+                                   will be ignored, and provided `owner_client_id` will be used instead.
+            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}/reset_bot_secret',
+                             json=payload,
+                             headers=headers)
+
+
+
+def reset_bot_template_secret(self, id: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Resets secret for given bot template.

+

Args

+
+
id : str
+
Bot Template ID.
+
owner_client_id : str
+
Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
+
affect_existing_installations : bool
+
based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
+
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.
+
+
+ +Expand source code + +
def reset_bot_template_secret(self,
+                              id: str = None,
+                              owner_client_id: str = None,
+                              affect_existing_installations: bool = None,
+                              payload: dict = None,
+                              headers: dict = None) -> httpx.Response:
+    ''' Resets secret for given bot template.
+
+        Args:
+            id (str): Bot Template ID.
+            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
+                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
+                                   will be ignored, and provided `owner_client_id` will be used instead.
+            affect_existing_installations (bool): based on this template will be created on all licenses that have given
+                                                  application installed. Otherwise only new installations will trigger bot
+                                                  creation.
+            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}/reset_bot_template_secret',
+                             json=payload,
+                             headers=headers)
+
+
def suspend_agent(self, id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
@@ -5888,6 +6761,90 @@

Returns

headers=headers)

+
+def update_bot_template(self, id: str = None, name: str = None, avatar: str = None, max_chats_count: int = None, default_group_priority: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Updates an existing Bot Template.

+

Args

+
+
id : str
+
Bot Template ID.
+
name : str
+
Display name.
+
avatar : str
+
Avatar URL.
+
max_chats_count : int
+
Max. number of incoming chats that can be routed to the Bot.
+
default_group_priority : str
+
The default routing priority for a group without defined priority.
+
owner_client_id : str
+
Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
+
affect_existing_installations : bool
+
based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
+
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.
+
+
+ +Expand source code + +
def update_bot_template(self,
+                        id: str = None,
+                        name: str = None,
+                        avatar: str = None,
+                        max_chats_count: int = None,
+                        default_group_priority: str = None,
+                        owner_client_id: str = None,
+                        affect_existing_installations: bool = None,
+                        payload: dict = None,
+                        headers: dict = None) -> httpx.Response:
+    ''' Updates an existing Bot Template.
+
+        Args:
+            id (str): Bot Template ID.
+            name (str): Display name.
+            avatar (str): Avatar URL.
+            max_chats_count (int): Max. number of incoming chats that can be routed to the Bot.
+            default_group_priority (str): The default routing priority for a group without defined priority.
+            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
+                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
+                                   will be ignored, and provided `owner_client_id` will be used instead.
+            affect_existing_installations (bool): based on this template will be created on all licenses that have given
+                                                  application installed. Otherwise only new installations will trigger bot
+                                                  creation.
+            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}/update_bot_template',
+                             json=payload,
+                             headers=headers)
+
+
def update_group(self, id: int = None, name: str = None, language_code: str = None, agent_priorities: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
@@ -6155,11 +7112,13 @@

check_product_limits_for_plan
  • create_agent
  • create_bot
  • +
  • create_bot_template
  • create_group
  • create_tag
  • delete_agent
  • delete_auto_access
  • delete_bot
  • +
  • delete_bot_template
  • delete_group
  • delete_group_properties
  • delete_license_properties
  • @@ -6171,8 +7130,10 @@

    get_group
  • get_license_webhooks_state
  • get_product_source
  • +
  • issue_bot_token
  • list_agents
  • list_auto_accesses
  • +
  • list_bot_templates
  • list_bots
  • list_channels
  • list_groups
  • @@ -6186,6 +7147,8 @@

    register_property
  • register_webhook
  • request_agent_unsuspension
  • +
  • reset_bot_secret
  • +
  • reset_bot_template_secret
  • suspend_agent
  • unregister_property
  • unregister_webhook
  • @@ -6193,6 +7156,7 @@

    update_agent
  • update_auto_access
  • update_bot
  • +
  • update_bot_template
  • update_group
  • update_group_properties
  • update_license_properties
  • @@ -6208,4 +7172,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/configuration/api/v36.html b/docs/configuration/api/v36.html index 60a1a48..7355980 100644 --- a/docs/configuration/api/v36.html +++ b/docs/configuration/api/v36.html @@ -29,12 +29,13 @@

    Module livechat.configuration.api.v36

    ''' Configuration API module with client class in version 3.6. '''
     
    -from typing import List
    +from typing import List, Union
     
     import httpx
     
     from livechat.utils.helpers import prepare_payload
     from livechat.utils.http_client import HttpClient
    +from livechat.utils.structures import AccessToken
     
     # pylint: disable=unused-argument,too-many-arguments,redefined-builtin,invalid-name
     
    @@ -42,14 +43,15 @@ 

    Module livechat.configuration.api.v36

    class ConfigurationApiV36(HttpClient): ''' Configuration API client class in version 3.6. ''' def __init__(self, - token: str, + token: Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): super().__init__(token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) self.api_url = f'https://{base_url}/v3.6/configuration/action' # Agents @@ -466,6 +468,48 @@

    Module livechat.configuration.api.v36

    json=payload, headers=headers) + def create_bot_template(self, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + job_title: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Creates a new bot template for the Client ID (application) provided in the request. + One Client ID can register up to five bot templates. + Bots based on the template will be automatically created on the license when the application is installed. + The bots will have the same ID as the bot template. If the application is already installed on the license, + the bots will be created only if `affect_existing_installations` is set to `true`. + Args: + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6. + default_group_priority (str): The default routing priority for a group without defined priority. + job_title (str): Bot's job title. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/create_bot_template', + json=payload, + headers=headers) + def delete_bot(self, id: str = None, payload: dict = None, @@ -490,6 +534,39 @@

    Module livechat.configuration.api.v36

    json=payload, headers=headers) + def delete_bot_template(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Deletes a bot template specified by `id`. The bots associated with the template will + be deleted only if `affect_existing_installations` is set to `true`. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/delete_bot_template', + json=payload, + headers=headers) + def update_bot(self, id: str = None, name: str = None, @@ -528,6 +605,46 @@

    Module livechat.configuration.api.v36

    json=payload, headers=headers) + def update_bot_template(self, + id: str = None, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Updates an existing Bot Template. + + Args: + id (str): Bot Template ID. + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot. + default_group_priority (str): The default routing priority for a group without defined priority. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/update_bot_template', + json=payload, + headers=headers) + def list_bots(self, all: bool = None, fields: list = None, @@ -554,6 +671,32 @@

    Module livechat.configuration.api.v36

    json=payload, headers=headers) + def list_bot_templates(self, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Returns the list of Bot Templates created for the Client ID (application). + + Args: + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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_bot_templates', + json=payload, + headers=headers) + def get_bot(self, id: str = None, fields: list = None, @@ -580,6 +723,96 @@

    Module livechat.configuration.api.v36

    json=payload, headers=headers) + def issue_bot_token(self, + bot_id: str = None, + bot_secret: str = None, + organization_id: str = None, + client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked. + + Args: + bot_id (str): Bot's ID. + bot_secret (str): Bot's secret. + organization_id (str): Organization's ID. + client_id (str): Client's ID. + 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}/issue_bot_token', + json=payload, + headers=headers) + + def reset_bot_secret(self, + id: str = None, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot. + + Args: + id (str): Bot's ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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}/reset_bot_secret', + json=payload, + headers=headers) + + def reset_bot_template_secret(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot template. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/reset_bot_template_secret', + json=payload, + headers=headers) + # Groups def create_group(self, @@ -1604,7 +1837,7 @@

    Classes

    class ConfigurationApiV36 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Configuration API client class in version 3.6.

    @@ -1615,14 +1848,15 @@

    Classes

    class ConfigurationApiV36(HttpClient):
         ''' Configuration API client class in version 3.6. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.6/configuration/action'
     
     # Agents
    @@ -2039,6 +2273,48 @@ 

    Classes

    json=payload, headers=headers) + def create_bot_template(self, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + job_title: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Creates a new bot template for the Client ID (application) provided in the request. + One Client ID can register up to five bot templates. + Bots based on the template will be automatically created on the license when the application is installed. + The bots will have the same ID as the bot template. If the application is already installed on the license, + the bots will be created only if `affect_existing_installations` is set to `true`. + Args: + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6. + default_group_priority (str): The default routing priority for a group without defined priority. + job_title (str): Bot's job title. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/create_bot_template', + json=payload, + headers=headers) + def delete_bot(self, id: str = None, payload: dict = None, @@ -2063,6 +2339,39 @@

    Classes

    json=payload, headers=headers) + def delete_bot_template(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Deletes a bot template specified by `id`. The bots associated with the template will + be deleted only if `affect_existing_installations` is set to `true`. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/delete_bot_template', + json=payload, + headers=headers) + def update_bot(self, id: str = None, name: str = None, @@ -2101,6 +2410,46 @@

    Classes

    json=payload, headers=headers) + def update_bot_template(self, + id: str = None, + name: str = None, + avatar: str = None, + max_chats_count: int = None, + default_group_priority: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Updates an existing Bot Template. + + Args: + id (str): Bot Template ID. + name (str): Display name. + avatar (str): Avatar URL. + max_chats_count (int): Max. number of incoming chats that can be routed to the Bot. + default_group_priority (str): The default routing priority for a group without defined priority. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/update_bot_template', + json=payload, + headers=headers) + def list_bots(self, all: bool = None, fields: list = None, @@ -2127,6 +2476,32 @@

    Classes

    json=payload, headers=headers) + def list_bot_templates(self, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Returns the list of Bot Templates created for the Client ID (application). + + Args: + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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_bot_templates', + json=payload, + headers=headers) + def get_bot(self, id: str = None, fields: list = None, @@ -2153,6 +2528,96 @@

    Classes

    json=payload, headers=headers) + def issue_bot_token(self, + bot_id: str = None, + bot_secret: str = None, + organization_id: str = None, + client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked. + + Args: + bot_id (str): Bot's ID. + bot_secret (str): Bot's secret. + organization_id (str): Organization's ID. + client_id (str): Client's ID. + 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}/issue_bot_token', + json=payload, + headers=headers) + + def reset_bot_secret(self, + id: str = None, + owner_client_id: str = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot. + + Args: + id (str): Bot's ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + 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}/reset_bot_secret', + json=payload, + headers=headers) + + def reset_bot_template_secret(self, + id: str = None, + owner_client_id: str = None, + affect_existing_installations: bool = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Resets secret for given bot template. + + Args: + id (str): Bot Template ID. + owner_client_id (str): Required only when authorizing via PAT. When you provide this param while + authorizing with a Bearer Token, the `client_id` associated with the Bearer Token + will be ignored, and provided `owner_client_id` will be used instead. + affect_existing_installations (bool): based on this template will be created on all licenses that have given + application installed. Otherwise only new installations will trigger bot + creation. + 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}/reset_bot_template_secret', + json=payload, + headers=headers) + # Groups def create_group(self, @@ -3884,6 +4349,96 @@

    Returns

    headers=headers)
    +
    +def create_bot_template(self, name: str = None, avatar: str = None, max_chats_count: int = None, default_group_priority: str = None, job_title: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +
    +

    Creates a new bot template for the Client ID (application) provided in the request. +One Client ID can register up to five bot templates. +Bots based on the template will be automatically created on the license when the application is installed. +The bots will have the same ID as the bot template. If the application is already installed on the license, +the bots will be created only if affect_existing_installations is set to true.

    +

    Args

    +
    +
    name : str
    +
    Display name.
    +
    avatar : str
    +
    Avatar URL.
    +
    max_chats_count : int
    +
    Max. number of incoming chats that can be routed to the Bot; default: 6.
    +
    default_group_priority : str
    +
    The default routing priority for a group without defined priority.
    +
    job_title : str
    +
    Bot's job title.
    +
    owner_client_id : str
    +
    Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
    +
    affect_existing_installations : bool
    +
    based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
    +
    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.
    +
    +
    + +Expand source code + +
    def create_bot_template(self,
    +                        name: str = None,
    +                        avatar: str = None,
    +                        max_chats_count: int = None,
    +                        default_group_priority: str = None,
    +                        job_title: str = None,
    +                        owner_client_id: str = None,
    +                        affect_existing_installations: bool = None,
    +                        payload: dict = None,
    +                        headers: dict = None) -> httpx.Response:
    +    ''' Creates a new bot template for the Client ID (application) provided in the request.
    +        One Client ID can register up to five bot templates.
    +        Bots based on the template will be automatically created on the license when the application is installed.
    +        The bots will have the same ID as the bot template. If the application is already installed on the license,
    +        the bots will be created only if `affect_existing_installations` is set to `true`.
    +        Args:
    +            name (str): Display name.
    +            avatar (str): Avatar URL.
    +            max_chats_count (int): Max. number of incoming chats that can be routed to the Bot; default: 6.
    +            default_group_priority (str): The default routing priority for a group without defined priority.
    +            job_title (str): Bot's job title.
    +            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
    +                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
    +                                   will be ignored, and provided `owner_client_id` will be used instead.
    +            affect_existing_installations (bool): based on this template will be created on all licenses that have given
    +                                                  application installed. Otherwise only new installations will trigger bot
    +                                                  creation.
    +            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}/create_bot_template',
    +                             json=payload,
    +                             headers=headers)
    +
    +
    def create_group(self, name: str = None, language_code: str = None, agent_priorities: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
    @@ -4099,20 +4654,81 @@

    Returns

    ''' if payload is None: payload = prepare_payload(locals()) - return self.session.post(f'{self.api_url}/delete_auto_access', + return self.session.post(f'{self.api_url}/delete_auto_access', + json=payload, + headers=headers)
    + +

    +
    +def delete_bot(self, id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +
    +

    Deletes a Bot.

    +

    Args

    +
    +
    id : str
    +
    Bot's ID.
    +
    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.
    +
    +
    + +Expand source code + +
    def delete_bot(self,
    +               id: str = None,
    +               payload: dict = None,
    +               headers: dict = None) -> httpx.Response:
    +    ''' Deletes a Bot.
    +
    +        Args:
    +            id (str): Bot's ID.
    +            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}/delete_bot',
                                  json=payload,
                                  headers=headers)
    -
    -def delete_bot(self, id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +def delete_bot_template(self, id: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
    -

    Deletes a Bot.

    +

    Deletes a bot template specified by id. The bots associated with the template will +be deleted only if affect_existing_installations is set to true.

    Args

    id : str
    -
    Bot's ID.
    +
    Bot Template ID.
    +
    owner_client_id : str
    +
    Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
    +
    affect_existing_installations : bool
    +
    based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
    payload : dict
    Custom payload to be used as request's data. It overrides all other parameters provided for the method.
    @@ -4131,14 +4747,23 @@

    Returns

    Expand source code -
    def delete_bot(self,
    -               id: str = None,
    -               payload: dict = None,
    -               headers: dict = None) -> httpx.Response:
    -    ''' Deletes a Bot.
    +
    def delete_bot_template(self,
    +                        id: str = None,
    +                        owner_client_id: str = None,
    +                        affect_existing_installations: bool = None,
    +                        payload: dict = None,
    +                        headers: dict = None) -> httpx.Response:
    +    ''' Deletes a bot template specified by `id`. The bots associated with the template will
    +        be deleted only if `affect_existing_installations` is set to `true`.
     
             Args:
    -            id (str): Bot's ID.
    +            id (str): Bot Template ID.
    +            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
    +                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
    +                                   will be ignored, and provided `owner_client_id` will be used instead.
    +            affect_existing_installations (bool): based on this template will be created on all licenses that have given
    +                                                  application installed. Otherwise only new installations will trigger bot
    +                                                  creation.
                 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.
    @@ -4151,7 +4776,7 @@ 

    Returns

    ''' if payload is None: payload = prepare_payload(locals()) - return self.session.post(f'{self.api_url}/delete_bot', + return self.session.post(f'{self.api_url}/delete_bot_template', json=payload, headers=headers)
    @@ -4742,6 +5367,70 @@

    Returns

    headers=headers)
    +
    +def issue_bot_token(self, bot_id: str = None, bot_secret: str = None, organization_id: str = None, client_id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +
    +

    Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked.

    +

    Args

    +
    +
    bot_id : str
    +
    Bot's ID.
    +
    bot_secret : str
    +
    Bot's secret.
    +
    organization_id : str
    +
    Organization's ID.
    +
    client_id : str
    +
    Client's ID.
    +
    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.
    +
    +
    + +Expand source code + +
    def issue_bot_token(self,
    +                    bot_id: str = None,
    +                    bot_secret: str = None,
    +                    organization_id: str = None,
    +                    client_id: str = None,
    +                    payload: dict = None,
    +                    headers: dict = None) -> httpx.Response:
    +    ''' Issues a new token for the Bot. The token is valid for 24 hours. The token cannot be revoked.
    +
    +        Args:
    +            bot_id (str): Bot's ID.
    +            bot_secret (str): Bot's secret.
    +            organization_id (str): Organization's ID.
    +            client_id (str): Client's ID.
    +            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}/issue_bot_token',
    +                             json=payload,
    +                             headers=headers)
    +
    +
    def list_agents(self, filters: dict = None, fields: list = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
    @@ -4843,6 +5532,62 @@

    Args

    headers=headers)

    +
    +def list_bot_templates(self, owner_client_id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +
    +

    Returns the list of Bot Templates created for the Client ID (application).

    +

    Args

    +
    +
    owner_client_id : str
    +
    Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
    +
    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.
    +
    +
    + +Expand source code + +
    def list_bot_templates(self,
    +                       owner_client_id: str = None,
    +                       payload: dict = None,
    +                       headers: dict = None) -> httpx.Response:
    +    ''' Returns the list of Bot Templates created for the Client ID (application).
    +
    +        Args:
    +            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
    +                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
    +                                   will be ignored, and provided `owner_client_id` will be used instead.
    +            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_bot_templates',
    +                             json=payload,
    +                             headers=headers)
    +
    +
    def list_bots(self, all: bool = None, fields: list = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
    @@ -5640,6 +6385,134 @@

    Returns

    headers=headers)

    +
    +def reset_bot_secret(self, id: str = None, owner_client_id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +
    +

    Resets secret for given bot.

    +

    Args

    +
    +
    id : str
    +
    Bot's ID.
    +
    owner_client_id : str
    +
    Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
    +
    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.
    +
    +
    + +Expand source code + +
    def reset_bot_secret(self,
    +                     id: str = None,
    +                     owner_client_id: str = None,
    +                     payload: dict = None,
    +                     headers: dict = None) -> httpx.Response:
    +    ''' Resets secret for given bot.
    +
    +        Args:
    +            id (str): Bot's ID.
    +            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
    +                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
    +                                   will be ignored, and provided `owner_client_id` will be used instead.
    +            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}/reset_bot_secret',
    +                             json=payload,
    +                             headers=headers)
    +
    +
    +
    +def reset_bot_template_secret(self, id: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +
    +

    Resets secret for given bot template.

    +

    Args

    +
    +
    id : str
    +
    Bot Template ID.
    +
    owner_client_id : str
    +
    Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
    +
    affect_existing_installations : bool
    +
    based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
    +
    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.
    +
    +
    + +Expand source code + +
    def reset_bot_template_secret(self,
    +                              id: str = None,
    +                              owner_client_id: str = None,
    +                              affect_existing_installations: bool = None,
    +                              payload: dict = None,
    +                              headers: dict = None) -> httpx.Response:
    +    ''' Resets secret for given bot template.
    +
    +        Args:
    +            id (str): Bot Template ID.
    +            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
    +                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
    +                                   will be ignored, and provided `owner_client_id` will be used instead.
    +            affect_existing_installations (bool): based on this template will be created on all licenses that have given
    +                                                  application installed. Otherwise only new installations will trigger bot
    +                                                  creation.
    +            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}/reset_bot_template_secret',
    +                             json=payload,
    +                             headers=headers)
    +
    +
    def suspend_agent(self, id: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
    @@ -6090,6 +6963,90 @@

    Returns

    headers=headers)

    +
    +def update_bot_template(self, id: str = None, name: str = None, avatar: str = None, max_chats_count: int = None, default_group_priority: str = None, owner_client_id: str = None, affect_existing_installations: bool = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
    +
    +

    Updates an existing Bot Template.

    +

    Args

    +
    +
    id : str
    +
    Bot Template ID.
    +
    name : str
    +
    Display name.
    +
    avatar : str
    +
    Avatar URL.
    +
    max_chats_count : int
    +
    Max. number of incoming chats that can be routed to the Bot.
    +
    default_group_priority : str
    +
    The default routing priority for a group without defined priority.
    +
    owner_client_id : str
    +
    Required only when authorizing via PAT. When you provide this param while +authorizing with a Bearer Token, the client_id associated with the Bearer Token +will be ignored, and provided owner_client_id will be used instead.
    +
    affect_existing_installations : bool
    +
    based on this template will be created on all licenses that have given +application installed. Otherwise only new installations will trigger bot +creation.
    +
    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.
    +
    +
    + +Expand source code + +
    def update_bot_template(self,
    +                        id: str = None,
    +                        name: str = None,
    +                        avatar: str = None,
    +                        max_chats_count: int = None,
    +                        default_group_priority: str = None,
    +                        owner_client_id: str = None,
    +                        affect_existing_installations: bool = None,
    +                        payload: dict = None,
    +                        headers: dict = None) -> httpx.Response:
    +    ''' Updates an existing Bot Template.
    +
    +        Args:
    +            id (str): Bot Template ID.
    +            name (str): Display name.
    +            avatar (str): Avatar URL.
    +            max_chats_count (int): Max. number of incoming chats that can be routed to the Bot.
    +            default_group_priority (str): The default routing priority for a group without defined priority.
    +            owner_client_id (str): Required only when authorizing via PAT. When you provide this param while
    +                                   authorizing with a Bearer Token, the `client_id` associated with the Bearer Token
    +                                   will be ignored, and provided `owner_client_id` will be used instead.
    +            affect_existing_installations (bool): based on this template will be created on all licenses that have given
    +                                                  application installed. Otherwise only new installations will trigger bot
    +                                                  creation.
    +            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}/update_bot_template',
    +                             json=payload,
    +                             headers=headers)
    +
    +
    def update_company_details(self, enrich: bool = None, audience: str = None, chat_purpose: str = None, city: str = None, company: str = None, company_size: str = None, country: str = None, invoice_email: str = None, invoice_name: str = None, nip: str = None, postal_code: str = None, state: str = None, street: str = None, phone: str = None, province: str = None, url: str = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
    @@ -6469,11 +7426,13 @@

    check_product_limits_for_plan
  • create_agent
  • create_bot
  • +
  • create_bot_template
  • create_group
  • create_tag
  • delete_agent
  • delete_auto_access
  • delete_bot
  • +
  • delete_bot_template
  • delete_group
  • delete_group_properties
  • delete_license_properties
  • @@ -6485,8 +7444,10 @@

    get_group
  • get_license_webhooks_state
  • get_product_source
  • +
  • issue_bot_token
  • list_agents
  • list_auto_accesses
  • +
  • list_bot_templates
  • list_bots
  • list_channels
  • list_groups
  • @@ -6501,6 +7462,8 @@

    register_property
  • register_webhook
  • request_agent_unsuspension
  • +
  • reset_bot_secret
  • +
  • reset_bot_template_secret
  • suspend_agent
  • unregister_property
  • unregister_webhook
  • @@ -6508,6 +7471,7 @@

    update_agent
  • update_auto_access
  • update_bot
  • +
  • update_bot_template
  • update_company_details
  • update_group
  • update_group_properties
  • @@ -6524,4 +7488,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/configuration/base.html b/docs/configuration/base.html index bbd3368..09060c9 100644 --- a/docs/configuration/base.html +++ b/docs/configuration/base.html @@ -37,11 +37,14 @@

    Module livechat.configuration.base

    from typing import Union +import httpx + from livechat.config import CONFIG from livechat.configuration.api.v33 import ConfigurationApiV33 from livechat.configuration.api.v34 import ConfigurationApiV34 from livechat.configuration.api.v35 import ConfigurationApiV35 from livechat.configuration.api.v36 import ConfigurationApiV36 +from livechat.utils.structures import AccessToken stable_version = CONFIG.get('stable') api_url = CONFIG.get('url') @@ -52,14 +55,16 @@

    Module livechat.configuration.base

    API version. ''' @staticmethod def get_client( - token: str, + token: Union[AccessToken, str], version: str = stable_version, base_url: str = api_url, http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, - ) -> Union[ConfigurationApiV33, ConfigurationApiV34, ConfigurationApiV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[ConfigurationApiV33, ConfigurationApiV34, ConfigurationApiV35, + ConfigurationApiV36]: ''' Returns client for specific Configuration API version. Args: @@ -75,6 +80,8 @@

    Module livechat.configuration.base

    a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: ConfigurationApi: API client object for specified version. @@ -85,16 +92,16 @@

    Module livechat.configuration.base

    client = { '3.3': ConfigurationApiV33(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': ConfigurationApiV34(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': ConfigurationApiV35(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': ConfigurationApiV36(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -125,14 +132,16 @@

    Classes

    API version. ''' @staticmethod def get_client( - token: str, + token: Union[AccessToken, str], version: str = stable_version, base_url: str = api_url, http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, - ) -> Union[ConfigurationApiV33, ConfigurationApiV34, ConfigurationApiV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[ConfigurationApiV33, ConfigurationApiV34, ConfigurationApiV35, + ConfigurationApiV36]: ''' Returns client for specific Configuration API version. Args: @@ -148,6 +157,8 @@

    Classes

    a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: ConfigurationApi: API client object for specified version. @@ -158,16 +169,16 @@

    Classes

    client = { '3.3': ConfigurationApiV33(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': ConfigurationApiV34(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': ConfigurationApiV35(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': ConfigurationApiV36(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -176,7 +187,7 @@

    Classes

    Static methods

    -def get_client(token: str, version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False) ‑> Union[ConfigurationApiV33ConfigurationApiV34ConfigurationApiV35] +def get_client(token: Union[AccessToken, str], version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15)) ‑> Union[ConfigurationApiV33ConfigurationApiV34ConfigurationApiV35ConfigurationApiV36]

    Returns client for specific Configuration API version.

    @@ -201,6 +212,9 @@

    Args

    (which will disable verification). Defaults to True.
    disable_logging : bool
    indicates if logging should be disabled.
    +
    timeout : float
    +
    The timeout configuration to use when sending requests. +Defaults to 15 seconds.

    Returns

    @@ -218,14 +232,16 @@

    Raises

    @staticmethod
     def get_client(
    -    token: str,
    +    token: Union[AccessToken, str],
         version: str = stable_version,
         base_url: str = api_url,
         http2: bool = False,
         proxies: dict = None,
         verify: bool = True,
         disable_logging: bool = False,
    -) -> Union[ConfigurationApiV33, ConfigurationApiV34, ConfigurationApiV35]:
    +    timeout: float = httpx.Timeout(15)
    +) -> Union[ConfigurationApiV33, ConfigurationApiV34, ConfigurationApiV35,
    +           ConfigurationApiV36]:
         ''' Returns client for specific Configuration API version.
     
             Args:
    @@ -241,6 +257,8 @@ 

    Raises

    a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: ConfigurationApi: API client object for specified version. @@ -251,16 +269,16 @@

    Raises

    client = { '3.3': ConfigurationApiV33(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': ConfigurationApiV34(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': ConfigurationApiV35(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': ConfigurationApiV36(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -300,4 +318,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/configuration/index.html b/docs/configuration/index.html index 2dfbb00..524e691 100644 --- a/docs/configuration/index.html +++ b/docs/configuration/index.html @@ -75,4 +75,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/index.html b/docs/customer/index.html index c18d944..f00cecb 100644 --- a/docs/customer/index.html +++ b/docs/customer/index.html @@ -75,4 +75,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/rtm/api/index.html b/docs/customer/rtm/api/index.html index bcf6b9e..6eba2d1 100644 --- a/docs/customer/rtm/api/index.html +++ b/docs/customer/rtm/api/index.html @@ -77,4 +77,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/rtm/api/v33.html b/docs/customer/rtm/api/v33.html index 8ca5a9a..ff4673c 100644 --- a/docs/customer/rtm/api/v33.html +++ b/docs/customer/rtm/api/v33.html @@ -31,8 +31,10 @@

    Module livechat.customer.rtm.api.v33

    # pylint: disable=C0103,R0903,R0913,W0107,W0231,W0613,W0622 +from typing import Optional, Union + from livechat.utils.helpers import prepare_payload -from livechat.utils.structures import RtmResponse +from livechat.utils.structures import AccessToken, RtmResponse from livechat.utils.ws_client import WebsocketClient @@ -49,15 +51,26 @@

    Module livechat.customer.rtm.api.v33

    f'Provided `license_id` (`{license_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -510,7 +523,9 @@

    Module livechat.customer.rtm.api.v33

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -522,6 +537,8 @@

    Module livechat.customer.rtm.api.v33

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -700,15 +717,26 @@

    Classes

    f'Provided `license_id` (`{license_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1161,7 +1189,9 @@

    Classes

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -1173,6 +1203,8 @@

    Classes

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1996,7 +2028,7 @@

    Returns

    -def login(self, token: str = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str, None] = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

    Logs in customer.

    @@ -2017,7 +2049,9 @@

    Returns

    Expand source code -
    def login(self, token: str = None, payload: dict = None) -> RtmResponse:
    +
    def login(self,
    +          token: Optional[Union[AccessToken, str]] = None,
    +          payload: dict = None) -> RtmResponse:
         ''' Logs in customer.
     
             Args:
    @@ -2029,6 +2063,8 @@ 

    Returns

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
    @@ -2084,7 +2120,7 @@

    Returns

    -def open_connection(self, origin: dict = None) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None

    Opens WebSocket connection.

    @@ -2092,20 +2128,41 @@

    Args

    origin : dict
    Specifies origin while creating websocket connection.
    -
    +
    ping_timeout : int or float
    +
    timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
    +
    ping_interval : int or float
    +
    automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +
    ws_conn_timeout : int or float
    +
    timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
    +

    +

    keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

    Expand source code -
    def open_connection(self, origin: dict = None) -> None:
    +
    def open_connection(self,
    +                    origin: dict = None,
    +                    ping_timeout: float = 3,
    +                    ping_interval: float = 5,
    +                    ws_conn_timeout: float = 10,
    +                    keep_alive: bool = True) -> None:
         ''' Opens WebSocket connection.
    +
             Args:
                 origin (dict): Specifies origin while creating websocket connection.
    +            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
    +                by default sets to 3 seconds.
    +            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
    +                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
    +                by default sets to 10 seconds.
    +            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
         '''
    -    if origin:
    -        self.ws.open(origin=origin)
    -    else:
    -        self.ws.open()
    + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive)
    @@ -2731,4 +2788,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/rtm/api/v34.html b/docs/customer/rtm/api/v34.html index 178c6f5..719590e 100644 --- a/docs/customer/rtm/api/v34.html +++ b/docs/customer/rtm/api/v34.html @@ -31,8 +31,10 @@

    Module livechat.customer.rtm.api.v34

    # pylint: disable=C0103,R0903,R0913,W0107,W0231,W0613,W0622 +from typing import Optional, Union + from livechat.utils.helpers import prepare_payload -from livechat.utils.structures import RtmResponse +from livechat.utils.structures import AccessToken, RtmResponse from livechat.utils.ws_client import WebsocketClient @@ -49,15 +51,26 @@

    Module livechat.customer.rtm.api.v34

    f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -510,7 +523,9 @@

    Module livechat.customer.rtm.api.v34

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -522,6 +537,8 @@

    Module livechat.customer.rtm.api.v34

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -700,15 +717,26 @@

    Classes

    f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1161,7 +1189,9 @@

    Classes

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -1173,6 +1203,8 @@

    Classes

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1996,7 +2028,7 @@

    Returns

    -def login(self, token: str = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str, None] = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

    Logs in customer.

    @@ -2017,7 +2049,9 @@

    Returns

    Expand source code -
    def login(self, token: str = None, payload: dict = None) -> RtmResponse:
    +
    def login(self,
    +          token: Optional[Union[AccessToken, str]] = None,
    +          payload: dict = None) -> RtmResponse:
         ''' Logs in customer.
     
             Args:
    @@ -2029,6 +2063,8 @@ 

    Returns

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
    @@ -2084,7 +2120,7 @@

    Returns

    -def open_connection(self, origin: dict = None) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None

    Opens WebSocket connection.

    @@ -2092,20 +2128,41 @@

    Args

    origin : dict
    Specifies origin while creating websocket connection.
    -
    +
    ping_timeout : int or float
    +
    timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
    +
    ping_interval : int or float
    +
    automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +
    ws_conn_timeout : int or float
    +
    timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
    + +

    keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

    Expand source code -
    def open_connection(self, origin: dict = None) -> None:
    +
    def open_connection(self,
    +                    origin: dict = None,
    +                    ping_timeout: float = 3,
    +                    ping_interval: float = 5,
    +                    ws_conn_timeout: float = 10,
    +                    keep_alive: bool = True) -> None:
         ''' Opens WebSocket connection.
    +
             Args:
                 origin (dict): Specifies origin while creating websocket connection.
    +            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
    +                by default sets to 3 seconds.
    +            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
    +                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
    +                by default sets to 10 seconds.
    +            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
         '''
    -    if origin:
    -        self.ws.open(origin=origin)
    -    else:
    -        self.ws.open()
    + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive)
    @@ -2731,4 +2788,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/rtm/api/v35.html b/docs/customer/rtm/api/v35.html index 3833b0d..07d94f7 100644 --- a/docs/customer/rtm/api/v35.html +++ b/docs/customer/rtm/api/v35.html @@ -31,8 +31,10 @@

    Module livechat.customer.rtm.api.v35

    # pylint: disable=C0103,R0903,R0913,W0107,W0231,W0613,W0622 +from typing import Optional, Union + from livechat.utils.helpers import prepare_payload -from livechat.utils.structures import RtmResponse +from livechat.utils.structures import AccessToken, RtmResponse from livechat.utils.ws_client import WebsocketClient @@ -49,15 +51,26 @@

    Module livechat.customer.rtm.api.v35

    f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -510,7 +523,9 @@

    Module livechat.customer.rtm.api.v35

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -522,6 +537,8 @@

    Module livechat.customer.rtm.api.v35

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -700,15 +717,26 @@

    Classes

    f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1161,7 +1189,9 @@

    Classes

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -1173,6 +1203,8 @@

    Classes

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1996,7 +2028,7 @@

    Returns

    -def login(self, token: str = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str, None] = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

    Logs in customer.

    @@ -2017,7 +2049,9 @@

    Returns

    Expand source code -
    def login(self, token: str = None, payload: dict = None) -> RtmResponse:
    +
    def login(self,
    +          token: Optional[Union[AccessToken, str]] = None,
    +          payload: dict = None) -> RtmResponse:
         ''' Logs in customer.
     
             Args:
    @@ -2029,6 +2063,8 @@ 

    Returns

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
    @@ -2084,7 +2120,7 @@

    Returns

    -def open_connection(self, origin: dict = None) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None

    Opens WebSocket connection.

    @@ -2092,20 +2128,41 @@

    Args

    origin : dict
    Specifies origin while creating websocket connection.
    -
    +
    ping_timeout : int or float
    +
    timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
    +
    ping_interval : int or float
    +
    automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +
    ws_conn_timeout : int or float
    +
    timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
    + +

    keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

    Expand source code -
    def open_connection(self, origin: dict = None) -> None:
    +
    def open_connection(self,
    +                    origin: dict = None,
    +                    ping_timeout: float = 3,
    +                    ping_interval: float = 5,
    +                    ws_conn_timeout: float = 10,
    +                    keep_alive: bool = True) -> None:
         ''' Opens WebSocket connection.
    +
             Args:
                 origin (dict): Specifies origin while creating websocket connection.
    +            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
    +                by default sets to 3 seconds.
    +            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
    +                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
    +                by default sets to 10 seconds.
    +            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
         '''
    -    if origin:
    -        self.ws.open(origin=origin)
    -    else:
    -        self.ws.open()
    + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive)
    @@ -2731,4 +2788,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/rtm/api/v36.html b/docs/customer/rtm/api/v36.html index 09b74c5..c845bb9 100644 --- a/docs/customer/rtm/api/v36.html +++ b/docs/customer/rtm/api/v36.html @@ -31,8 +31,10 @@

    Module livechat.customer.rtm.api.v36

    # pylint: disable=C0103,R0903,R0913,W0107,W0231,W0613,W0622 +from typing import Optional, Union + from livechat.utils.helpers import prepare_payload -from livechat.utils.structures import RtmResponse +from livechat.utils.structures import AccessToken, RtmResponse from livechat.utils.ws_client import WebsocketClient @@ -49,15 +51,26 @@

    Module livechat.customer.rtm.api.v36

    f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -510,7 +523,9 @@

    Module livechat.customer.rtm.api.v36

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -522,6 +537,8 @@

    Module livechat.customer.rtm.api.v36

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -700,15 +717,26 @@

    Classes

    f'Provided `organization_id` (`{organization_id}`) seems invalid. Websocket connection may not open.' ) - def open_connection(self, origin: dict = None) -> None: + def open_connection(self, + origin: dict = None, + ping_timeout: float = 3, + ping_interval: float = 5, + ws_conn_timeout: float = 10, + keep_alive: bool = True) -> None: ''' Opens WebSocket connection. + Args: origin (dict): Specifies origin while creating websocket connection. + ping_timeout (int or float): timeout (in seconds) if the pong message is not received, + by default sets to 3 seconds. + ping_interval (int or float): automatically sends "ping" command every specified period (in seconds). + If set to 0, no ping is sent periodically, by default sets to 5 seconds. + ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection, + by default sets to 10 seconds. + keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`. ''' - if origin: - self.ws.open(origin=origin) - else: - self.ws.open() + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive) def close_connection(self) -> None: ''' Closes WebSocket connection. ''' @@ -1161,7 +1189,9 @@

    Classes

    # Status - def login(self, token: str = None, payload: dict = None) -> RtmResponse: + def login(self, + token: Optional[Union[AccessToken, str]] = None, + payload: dict = None) -> RtmResponse: ''' Logs in customer. Args: @@ -1173,6 +1203,8 @@

    Classes

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload}) @@ -1996,7 +2028,7 @@

    Returns

    -def login(self, token: str = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse +def login(self, token: Union[livechat.utils.structures.AccessToken, str, None] = None, payload: dict = None) ‑> livechat.utils.structures.RtmResponse

    Logs in customer.

    @@ -2017,7 +2049,9 @@

    Returns

    Expand source code -
    def login(self, token: str = None, payload: dict = None) -> RtmResponse:
    +
    def login(self,
    +          token: Optional[Union[AccessToken, str]] = None,
    +          payload: dict = None) -> RtmResponse:
         ''' Logs in customer.
     
             Args:
    @@ -2029,6 +2063,8 @@ 

    Returns

    RtmResponse: RTM response structure (`request_id`, `action`, `type`, `success` and `payload` properties) ''' + if token: + token = str(token) if payload is None: payload = prepare_payload(locals()) return self.ws.send({'action': 'login', 'payload': payload})
    @@ -2084,7 +2120,7 @@

    Returns

    -def open_connection(self, origin: dict = None) ‑> None +def open_connection(self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None

    Opens WebSocket connection.

    @@ -2092,20 +2128,41 @@

    Args

    origin : dict
    Specifies origin while creating websocket connection.
    -
    +
    ping_timeout : int or float
    +
    timeout (in seconds) if the pong message is not received, +by default sets to 3 seconds.
    +
    ping_interval : int or float
    +
    automatically sends "ping" command every specified period (in seconds). +If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +
    ws_conn_timeout : int or float
    +
    timeout (in seconds) to wait for WebSocket connection, +by default sets to 10 seconds.
    + +

    keep_alive(bool): Bool which states if connection should be kept, by default sets to True.

    Expand source code -
    def open_connection(self, origin: dict = None) -> None:
    +
    def open_connection(self,
    +                    origin: dict = None,
    +                    ping_timeout: float = 3,
    +                    ping_interval: float = 5,
    +                    ws_conn_timeout: float = 10,
    +                    keep_alive: bool = True) -> None:
         ''' Opens WebSocket connection.
    +
             Args:
                 origin (dict): Specifies origin while creating websocket connection.
    +            ping_timeout (int or float): timeout (in seconds) if the pong message is not received,
    +                by default sets to 3 seconds.
    +            ping_interval (int or float): automatically sends "ping" command every specified period (in seconds).
    +                If set to 0, no ping is sent periodically, by default sets to 5 seconds.
    +            ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
    +                by default sets to 10 seconds.
    +            keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
         '''
    -    if origin:
    -        self.ws.open(origin=origin)
    -    else:
    -        self.ws.open()
    + self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout, + keep_alive)
    @@ -2731,4 +2788,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/rtm/base.html b/docs/customer/rtm/base.html index eb8074c..9ce701e 100644 --- a/docs/customer/rtm/base.html +++ b/docs/customer/rtm/base.html @@ -37,6 +37,7 @@

    Module livechat.customer.rtm.base

    from livechat.customer.rtm.api.v33 import CustomerRtmV33 from livechat.customer.rtm.api.v34 import CustomerRtmV34 from livechat.customer.rtm.api.v35 import CustomerRtmV35 +from livechat.customer.rtm.api.v36 import CustomerRtmV36 stable_version = CONFIG.get('stable') api_url = CONFIG.get('url') @@ -50,7 +51,7 @@

    Module livechat.customer.rtm.base

    base_url: str = api_url, license_id: int = None, organization_id: str = None - ) -> Union[CustomerRtmV33, CustomerRtmV34, CustomerRtmV35]: + ) -> Union[CustomerRtmV33, CustomerRtmV34, CustomerRtmV35, CustomerRtmV36]: ''' Returns client for specific Customer RTM version. Args: @@ -69,7 +70,7 @@

    Module livechat.customer.rtm.base

    '3.3': CustomerRtmV33, '3.4': CustomerRtmV34, '3.5': CustomerRtmV35, - '3.6': CustomerRtmV35, + '3.6': CustomerRtmV36, }.get(version) client_kwargs = { '3.3': { @@ -120,7 +121,7 @@

    Classes

    base_url: str = api_url, license_id: int = None, organization_id: str = None - ) -> Union[CustomerRtmV33, CustomerRtmV34, CustomerRtmV35]: + ) -> Union[CustomerRtmV33, CustomerRtmV34, CustomerRtmV35, CustomerRtmV36]: ''' Returns client for specific Customer RTM version. Args: @@ -139,7 +140,7 @@

    Classes

    '3.3': CustomerRtmV33, '3.4': CustomerRtmV34, '3.5': CustomerRtmV35, - '3.6': CustomerRtmV35, + '3.6': CustomerRtmV36, }.get(version) client_kwargs = { '3.3': { @@ -166,7 +167,7 @@

    Classes

    Static methods

    -def get_client(version: str = '3.5', base_url: str = 'api.livechatinc.com', license_id: int = None, organization_id: str = None) ‑> Union[CustomerRtmV33CustomerRtmV34CustomerRtmV35] +def get_client(version: str = '3.5', base_url: str = 'api.livechatinc.com', license_id: int = None, organization_id: str = None) ‑> Union[CustomerRtmV33CustomerRtmV34CustomerRtmV35CustomerRtmV36]

    Returns client for specific Customer RTM version.

    @@ -198,7 +199,7 @@

    Raises

    base_url: str = api_url, license_id: int = None, organization_id: str = None -) -> Union[CustomerRtmV33, CustomerRtmV34, CustomerRtmV35]: +) -> Union[CustomerRtmV33, CustomerRtmV34, CustomerRtmV35, CustomerRtmV36]: ''' Returns client for specific Customer RTM version. Args: @@ -217,7 +218,7 @@

    Raises

    '3.3': CustomerRtmV33, '3.4': CustomerRtmV34, '3.5': CustomerRtmV35, - '3.6': CustomerRtmV35, + '3.6': CustomerRtmV36, }.get(version) client_kwargs = { '3.3': { @@ -275,4 +276,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/rtm/index.html b/docs/customer/rtm/index.html index 0261bd1..6e0a576 100644 --- a/docs/customer/rtm/index.html +++ b/docs/customer/rtm/index.html @@ -67,4 +67,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/web/api/index.html b/docs/customer/web/api/index.html index 7543aed..48c9136 100644 --- a/docs/customer/web/api/index.html +++ b/docs/customer/web/api/index.html @@ -77,4 +77,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/web/api/v33.html b/docs/customer/web/api/v33.html index 90f3091..dc75173 100644 --- a/docs/customer/web/api/v33.html +++ b/docs/customer/web/api/v33.html @@ -36,21 +36,23 @@

    Module livechat.customer.web.api.v33

    from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken class CustomerWebV33(HttpClient): ''' Customer Web API Class containing methods in version 3.3. ''' def __init__(self, license_id: int, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -1004,7 +1006,7 @@

    Classes

    class CustomerWebV33 -(license_id: int, access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(license_id: int, access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Customer Web API Class containing methods in version 3.3.

    @@ -1016,15 +1018,16 @@

    Classes

    ''' Customer Web API Class containing methods in version 3.3. ''' def __init__(self, license_id: int, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -3974,4 +3977,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/web/api/v34.html b/docs/customer/web/api/v34.html index af68cb1..99509c2 100644 --- a/docs/customer/web/api/v34.html +++ b/docs/customer/web/api/v34.html @@ -36,21 +36,23 @@

    Module livechat.customer.web.api.v34

    from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken class CustomerWebV34(HttpClient): ''' Customer Web API Class containing methods in version 3.4. ''' def __init__(self, organization_id: str, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -1004,7 +1006,7 @@

    Classes

    class CustomerWebV34 -(organization_id: str, access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(organization_id: str, access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Customer Web API Class containing methods in version 3.4.

    @@ -1016,15 +1018,16 @@

    Classes

    ''' Customer Web API Class containing methods in version 3.4. ''' def __init__(self, organization_id: str, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -3974,4 +3977,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/web/api/v35.html b/docs/customer/web/api/v35.html index bf56dca..48e6d89 100644 --- a/docs/customer/web/api/v35.html +++ b/docs/customer/web/api/v35.html @@ -36,21 +36,23 @@

    Module livechat.customer.web.api.v35

    from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken class CustomerWebV35(HttpClient): ''' Customer Web API Class containing methods in version 3.5. ''' def __init__(self, organization_id: str, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -1004,7 +1006,7 @@

    Classes

    class CustomerWebV35 -(organization_id: str, access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(organization_id: str, access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Customer Web API Class containing methods in version 3.5.

    @@ -1016,15 +1018,16 @@

    Classes

    ''' Customer Web API Class containing methods in version 3.5. ''' def __init__(self, organization_id: str, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -3974,4 +3977,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/web/api/v36.html b/docs/customer/web/api/v36.html index 6763f9e..7f97d9e 100644 --- a/docs/customer/web/api/v36.html +++ b/docs/customer/web/api/v36.html @@ -36,21 +36,23 @@

    Module livechat.customer.web.api.v36

    from livechat.utils.helpers import prepare_payload from livechat.utils.http_client import HttpClient +from livechat.utils.structures import AccessToken class CustomerWebV36(HttpClient): ''' Customer Web API Class containing methods in version 3.6. ''' def __init__(self, organization_id: str, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -1004,7 +1006,7 @@

    Classes

    class CustomerWebV36 -(organization_id: str, access_token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(organization_id: str, access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Customer Web API Class containing methods in version 3.6.

    @@ -1016,15 +1018,16 @@

    Classes

    ''' Customer Web API Class containing methods in version 3.6. ''' def __init__(self, organization_id: str, - access_token: str, + access_token: typing.Union[AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, - disable_logging: bool = False): + disable_logging: bool = False, + timeout: float = httpx.Timeout(15)): if all([access_token, isinstance(access_token, str)]): super().__init__(access_token, base_url, http2, proxies, verify, - disable_logging) + disable_logging, timeout) else: raise ValueError( 'Incorrect or missing `access_token` argument (should be of type str.)' @@ -3974,4 +3977,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/web/base.html b/docs/customer/web/base.html index c41b7dd..d1fea4f 100644 --- a/docs/customer/web/base.html +++ b/docs/customer/web/base.html @@ -32,13 +32,16 @@

    Module livechat.customer.web.base

    # pylint: disable=W0613,R0913,W0622,C0103 from __future__ import annotations -from typing import Union +from typing import Optional, Union + +import httpx from livechat.config import CONFIG from livechat.customer.web.api.v33 import CustomerWebV33 from livechat.customer.web.api.v34 import CustomerWebV34 from livechat.customer.web.api.v35 import CustomerWebV35 from livechat.customer.web.api.v36 import CustomerWebV36 +from livechat.utils.structures import AccessToken stable_version = CONFIG.get('stable') api_url = CONFIG.get('url') @@ -51,7 +54,7 @@

    Module livechat.customer.web.base

    @staticmethod def get_client( license_id: int = None, - access_token: str = None, + access_token: Optional[Union[AccessToken, str]] = None, version: str = stable_version, base_url: str = api_url, http2: bool = False, @@ -59,7 +62,8 @@

    Module livechat.customer.web.base

    verify: bool = True, organization_id: str = None, disable_logging: bool = False, - ) -> Union[CustomerWebV33, CustomerWebV34, CustomerWebV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[CustomerWebV33, CustomerWebV34, CustomerWebV35, CustomerWebV36]: ''' Returns client for specific API version. Args: @@ -77,6 +81,8 @@

    Module livechat.customer.web.base

    (which will disable verification). Defaults to `True`. organization_id (str): Organization ID, replaced license ID in v3.4. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: API client object for specified version based on @@ -99,7 +105,8 @@

    Module livechat.customer.web.base

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.4': { 'organization_id': organization_id, @@ -108,7 +115,8 @@

    Module livechat.customer.web.base

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.5': { 'organization_id': organization_id, @@ -117,7 +125,8 @@

    Module livechat.customer.web.base

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.6': { 'organization_id': organization_id, @@ -126,7 +135,8 @@

    Module livechat.customer.web.base

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, }.get(version) if client: @@ -159,7 +169,7 @@

    Classes

    @staticmethod def get_client( license_id: int = None, - access_token: str = None, + access_token: Optional[Union[AccessToken, str]] = None, version: str = stable_version, base_url: str = api_url, http2: bool = False, @@ -167,7 +177,8 @@

    Classes

    verify: bool = True, organization_id: str = None, disable_logging: bool = False, - ) -> Union[CustomerWebV33, CustomerWebV34, CustomerWebV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[CustomerWebV33, CustomerWebV34, CustomerWebV35, CustomerWebV36]: ''' Returns client for specific API version. Args: @@ -185,6 +196,8 @@

    Classes

    (which will disable verification). Defaults to `True`. organization_id (str): Organization ID, replaced license ID in v3.4. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: API client object for specified version based on @@ -207,7 +220,8 @@

    Classes

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.4': { 'organization_id': organization_id, @@ -216,7 +230,8 @@

    Classes

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.5': { 'organization_id': organization_id, @@ -225,7 +240,8 @@

    Classes

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.6': { 'organization_id': organization_id, @@ -234,7 +250,8 @@

    Classes

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, }.get(version) if client: @@ -244,7 +261,7 @@

    Classes

    Static methods

    -def get_client(license_id: int = None, access_token: str = None, version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, organization_id: str = None, disable_logging: bool = False) ‑> Union[CustomerWebV33CustomerWebV34CustomerWebV35] +def get_client(license_id: int = None, access_token: Optional[Union[AccessToken, str]] = None, version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, organization_id: str = None, disable_logging: bool = False, timeout: float = Timeout(timeout=15)) ‑> Union[CustomerWebV33CustomerWebV34CustomerWebV35CustomerWebV36]

    Returns client for specific API version.

    @@ -273,6 +290,9 @@

    Args

    Organization ID, replaced license ID in v3.4.
    disable_logging : bool
    indicates if logging should be disabled.
    +
    timeout : float
    +
    The timeout configuration to use when sending requests. +Defaults to 15 seconds.

    Returns

    API client object for specified version based on @@ -289,7 +309,7 @@

    Raises

    @staticmethod
     def get_client(
         license_id: int = None,
    -    access_token: str = None,
    +    access_token: Optional[Union[AccessToken, str]] = None,
         version: str = stable_version,
         base_url: str = api_url,
         http2: bool = False,
    @@ -297,7 +317,8 @@ 

    Raises

    verify: bool = True, organization_id: str = None, disable_logging: bool = False, -) -> Union[CustomerWebV33, CustomerWebV34, CustomerWebV35]: + timeout: float = httpx.Timeout(15) +) -> Union[CustomerWebV33, CustomerWebV34, CustomerWebV35, CustomerWebV36]: ''' Returns client for specific API version. Args: @@ -315,6 +336,8 @@

    Raises

    (which will disable verification). Defaults to `True`. organization_id (str): Organization ID, replaced license ID in v3.4. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: API client object for specified version based on @@ -337,7 +360,8 @@

    Raises

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.4': { 'organization_id': organization_id, @@ -346,7 +370,8 @@

    Raises

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.5': { 'organization_id': organization_id, @@ -355,7 +380,8 @@

    Raises

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, '3.6': { 'organization_id': organization_id, @@ -364,7 +390,8 @@

    Raises

    'http2': http2, 'proxies': proxies, 'verify': verify, - 'disable_logging': disable_logging + 'disable_logging': disable_logging, + 'timeout': timeout }, }.get(version) if client: @@ -405,4 +432,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/customer/web/index.html b/docs/customer/web/index.html index 828fcad..ef438b4 100644 --- a/docs/customer/web/index.html +++ b/docs/customer/web/index.html @@ -67,4 +67,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 2bf411c..f4bf444 100644 --- a/docs/index.html +++ b/docs/index.html @@ -87,4 +87,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/reports/api/index.html b/docs/reports/api/index.html index 17d7a9e..322cb0c 100644 --- a/docs/reports/api/index.html +++ b/docs/reports/api/index.html @@ -77,4 +77,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/reports/api/v33.html b/docs/reports/api/v33.html index 8bbee29..c8ff700 100644 --- a/docs/reports/api/v33.html +++ b/docs/reports/api/v33.html @@ -29,23 +29,27 @@

    Module livechat.reports.api.v33

    ''' Reports API module with client class in version 3.3. '''
     
    +from typing import Union
    +
     import httpx
     
     from livechat.utils.helpers import prepare_payload
     from livechat.utils.http_client import HttpClient
    +from livechat.utils.structures import AccessToken
     
     
     class ReportsApiV33(HttpClient):
         ''' Reports API client class in version 3.3. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.3/reports'
     
         # Chats
    @@ -172,7 +176,7 @@ 

    Classes

    class ReportsApiV33 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Reports API client class in version 3.3.

    @@ -183,14 +187,15 @@

    Classes

    class ReportsApiV33(HttpClient):
         ''' Reports API client class in version 3.3. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.3/reports'
     
         # Chats
    @@ -573,4 +578,4 @@ 

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/reports/api/v34.html b/docs/reports/api/v34.html index 916d4bd..1c29ebc 100644 --- a/docs/reports/api/v34.html +++ b/docs/reports/api/v34.html @@ -29,23 +29,27 @@

    Module livechat.reports.api.v34

    ''' Reports API module with client class in version 3.4. '''
     
    +from typing import Union
    +
     import httpx
     
     from livechat.utils.helpers import prepare_payload
     from livechat.utils.http_client import HttpClient
    +from livechat.utils.structures import AccessToken
     
     
     class ReportsApiV34(HttpClient):
         ''' Reports API client class in version 3.4. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.4/reports'
     
         # Chats
    @@ -422,7 +426,7 @@ 

    Classes

    class ReportsApiV34 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Reports API client class in version 3.4.

    @@ -433,14 +437,15 @@

    Classes

    class ReportsApiV34(HttpClient):
         ''' Reports API client class in version 3.4. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.4/reports'
     
         # Chats
    @@ -1619,4 +1624,4 @@ 

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/reports/api/v35.html b/docs/reports/api/v35.html index 1c7d79e..2b95074 100644 --- a/docs/reports/api/v35.html +++ b/docs/reports/api/v35.html @@ -29,23 +29,27 @@

    Module livechat.reports.api.v35

    ''' Reports API module with client class in version 3.5. '''
     
    +from typing import Union
    +
     import httpx
     
     from livechat.utils.helpers import prepare_payload
     from livechat.utils.http_client import HttpClient
    +from livechat.utils.structures import AccessToken
     
     
     class ReportsApiV35(HttpClient):
         ''' Reports API client class in version 3.5. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.5/reports'
     
     # Chats
    @@ -453,7 +457,7 @@ 

    Classes

    class ReportsApiV35 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Reports API client class in version 3.5.

    @@ -464,14 +468,15 @@

    Classes

    class ReportsApiV35(HttpClient):
         ''' Reports API client class in version 3.5. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.5/reports'
     
     # Chats
    @@ -1742,4 +1747,4 @@ 

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/reports/api/v36.html b/docs/reports/api/v36.html index d4dbf10..c567bee 100644 --- a/docs/reports/api/v36.html +++ b/docs/reports/api/v36.html @@ -29,23 +29,27 @@

    Module livechat.reports.api.v36

    ''' Reports API module with client class in version 3.6. '''
     
    +from typing import Union
    +
     import httpx
     
     from livechat.utils.helpers import prepare_payload
     from livechat.utils.http_client import HttpClient
    +from livechat.utils.structures import AccessToken
     
     
     class ReportsApiV36(HttpClient):
         ''' Reports API client class in version 3.6. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.6/reports'
     
     # Chats
    @@ -453,7 +457,7 @@ 

    Classes

    class ReportsApiV36 -(token: str, base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False) +(token: Union[livechat.utils.structures.AccessToken, str], base_url: str, http2: bool, proxies=None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15))

    Reports API client class in version 3.6.

    @@ -464,14 +468,15 @@

    Classes

    class ReportsApiV36(HttpClient):
         ''' Reports API client class in version 3.6. '''
         def __init__(self,
    -                 token: str,
    +                 token: Union[AccessToken, str],
                      base_url: str,
                      http2: bool,
                      proxies=None,
                      verify: bool = True,
    -                 disable_logging: bool = False):
    +                 disable_logging: bool = False,
    +                 timeout: float = httpx.Timeout(15)):
             super().__init__(token, base_url, http2, proxies, verify,
    -                         disable_logging)
    +                         disable_logging, timeout)
             self.api_url = f'https://{base_url}/v3.6/reports'
     
     # Chats
    @@ -1742,4 +1747,4 @@ 

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/reports/base.html b/docs/reports/base.html index 981ffe8..37d2276 100644 --- a/docs/reports/base.html +++ b/docs/reports/base.html @@ -38,11 +38,14 @@

    Module livechat.reports.base

    from typing import Union +import httpx + from livechat.config import CONFIG from livechat.reports.api.v33 import ReportsApiV33 from livechat.reports.api.v34 import ReportsApiV34 from livechat.reports.api.v35 import ReportsApiV35 from livechat.reports.api.v36 import ReportsApiV36 +from livechat.utils.structures import AccessToken stable_version = CONFIG.get('stable') api_url = CONFIG.get('url') @@ -53,14 +56,15 @@

    Module livechat.reports.base

    API version. ''' @staticmethod def get_client( - token: str, + token: Union[AccessToken, str], version: str = stable_version, base_url: str = api_url, http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, - ) -> Union[ReportsApiV33, ReportsApiV34, ReportsApiV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[ReportsApiV33, ReportsApiV34, ReportsApiV35, ReportsApiV36]: ''' Returns client for specific Reports API version. Args: @@ -76,6 +80,8 @@

    Module livechat.reports.base

    a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: ReportsApi: API client object for specified version. @@ -86,16 +92,16 @@

    Module livechat.reports.base

    client = { '3.3': ReportsApiV33(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': ReportsApiV34(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': ReportsApiV35(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': ReportsApiV36(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -126,14 +132,15 @@

    Classes

    API version. ''' @staticmethod def get_client( - token: str, + token: Union[AccessToken, str], version: str = stable_version, base_url: str = api_url, http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, - ) -> Union[ReportsApiV33, ReportsApiV34, ReportsApiV35]: + timeout: float = httpx.Timeout(15) + ) -> Union[ReportsApiV33, ReportsApiV34, ReportsApiV35, ReportsApiV36]: ''' Returns client for specific Reports API version. Args: @@ -149,6 +156,8 @@

    Classes

    a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: ReportsApi: API client object for specified version. @@ -159,16 +168,16 @@

    Classes

    client = { '3.3': ReportsApiV33(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': ReportsApiV34(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': ReportsApiV35(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': ReportsApiV36(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -177,7 +186,7 @@

    Classes

    Static methods

    -def get_client(token: str, version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False) ‑> Union[ReportsApiV33ReportsApiV34ReportsApiV35] +def get_client(token: Union[AccessToken, str], version: str = '3.5', base_url: str = 'api.livechatinc.com', http2: bool = False, proxies: dict = None, verify: bool = True, disable_logging: bool = False, timeout: float = Timeout(timeout=15)) ‑> Union[ReportsApiV33ReportsApiV34ReportsApiV35ReportsApiV36]

    Returns client for specific Reports API version.

    @@ -202,6 +211,9 @@

    Args

    (which will disable verification). Defaults to True.
    disable_logging : bool
    indicates if logging should be disabled.
    +
    timeout : float
    +
    The timeout configuration to use when sending requests. +Defaults to 15 seconds.

    Returns

    @@ -219,14 +231,15 @@

    Raises

    @staticmethod
     def get_client(
    -    token: str,
    +    token: Union[AccessToken, str],
         version: str = stable_version,
         base_url: str = api_url,
         http2: bool = False,
         proxies: dict = None,
         verify: bool = True,
         disable_logging: bool = False,
    -) -> Union[ReportsApiV33, ReportsApiV34, ReportsApiV35]:
    +    timeout: float = httpx.Timeout(15)
    +) -> Union[ReportsApiV33, ReportsApiV34, ReportsApiV35, ReportsApiV36]:
         ''' Returns client for specific Reports API version.
     
             Args:
    @@ -242,6 +255,8 @@ 

    Raises

    a path to an SSL certificate file, an `ssl.SSLContext`, or `False` (which will disable verification). Defaults to `True`. disable_logging (bool): indicates if logging should be disabled. + timeout (float): The timeout configuration to use when sending requests. + Defaults to 15 seconds. Returns: ReportsApi: API client object for specified version. @@ -252,16 +267,16 @@

    Raises

    client = { '3.3': ReportsApiV33(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.4': ReportsApiV34(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.5': ReportsApiV35(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), '3.6': ReportsApiV36(token, base_url, http2, proxies, verify, - disable_logging), + disable_logging, timeout), }.get(version) if not client: raise ValueError('Provided version does not exist.') @@ -301,4 +316,4 @@

    pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/docs/reports/index.html b/docs/reports/index.html index ce90862..6387dc6 100644 --- a/docs/reports/index.html +++ b/docs/reports/index.html @@ -75,4 +75,4 @@

    Index

    Generated by pdoc 0.10.0.

    - + \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index be8c098..bca8044 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = lc-sdk-python -version = 0.3.8 +version = 0.3.9 description = Package which lets to work with LiveChat API. long_description = file: README.md long_description_content_type = text/markdown