From dafe3882f3451b9c88c3633fc4fc3a1fe2d96983 Mon Sep 17 00:00:00 2001 From: Marcin Debski Date: Thu, 2 Dec 2021 12:00:56 +0100 Subject: [PATCH] CR fixes and docs added --- changelog.md | 2 +- docs/reports_api.html | 534 +++++++++++++++++++++++++++++++++++-- livechat/reports/client.py | 14 +- 3 files changed, 521 insertions(+), 29 deletions(-) diff --git a/changelog.md b/changelog.md index 497e34b..66b1c8c 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.1.10] - 2021-12-xx +## [0.1.10] - 2021-12-02 ### Added diff --git a/docs/reports_api.html b/docs/reports_api.html index d1f5aa2..c3308aa 100644 --- a/docs/reports_api.html +++ b/docs/reports_api.html @@ -3,7 +3,7 @@ - + client API documentation @@ -361,7 +361,7 @@

Module client

headers=headers) def ratings(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -391,7 +391,7 @@

Module client

headers=headers) def ranking(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -421,7 +421,7 @@

Module client

headers=headers) def engagement(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -450,10 +450,68 @@

Module client

json=payload, headers=headers) + def greetings_conversion(self, + distribution: str = None, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal. + + Args: + distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`. + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/chats/greetings_conversion', + json=payload, + headers=headers) + + def surveys(self, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Returns the number of submitted chat surveys along with the count of specific answers. + + Args: + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/chats/surveys', + json=payload, + headers=headers) + # Agents def availability(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -479,6 +537,66 @@

Module client

if payload is None: payload = prepare_payload(locals()) return self.session.post(f'{self.api_url}/agents/availability', + json=payload, + headers=headers) + + def response_time(self, + distribution: str = None, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Shows the average agents' response time within a licence. + + Args: + distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`. + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/agents/response_time', + json=payload, + headers=headers) + + def first_response_time(self, + distribution: str = None, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Shows the average agents' first response time within a licence. + + Args: + distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`. + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/agents/first_response_time', json=payload, headers=headers) @@ -1069,7 +1187,7 @@

Inherited members

headers=headers) def ratings(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -1099,7 +1217,7 @@

Inherited members

headers=headers) def ranking(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -1129,7 +1247,7 @@

Inherited members

headers=headers) def engagement(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -1158,10 +1276,68 @@

Inherited members

json=payload, headers=headers) + def greetings_conversion(self, + distribution: str = None, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal. + + Args: + distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`. + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/chats/greetings_conversion', + json=payload, + headers=headers) + + def surveys(self, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Returns the number of submitted chat surveys along with the count of specific answers. + + Args: + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/chats/surveys', + json=payload, + headers=headers) + # Agents def availability(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -1187,6 +1363,66 @@

Inherited members

if payload is None: payload = prepare_payload(locals()) return self.session.post(f'{self.api_url}/agents/availability', + json=payload, + headers=headers) + + def response_time(self, + distribution: str = None, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Shows the average agents' response time within a licence. + + Args: + distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`. + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/agents/response_time', + json=payload, + headers=headers) + + def first_response_time(self, + distribution: str = None, + timezone: str = None, + filters: dict = None, + payload: dict = None, + headers: dict = None) -> httpx.Response: + ''' Shows the average agents' first response time within a licence. + + Args: + distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`. + timezone (str): IANA Time Zone (e.g. America/Phoenix). + Defaults to the requester's timezone. + When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone. + filters (dict): If none provided, your report will span the last seven days. + 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}/agents/first_response_time', json=payload, headers=headers) @@ -1197,7 +1433,7 @@

Ancestors

Methods

-def availability(self, distribution: str = 'day', timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +def availability(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response

Shows for how long an agent, group, or the whole account was available for chatting during a specified period of time.

@@ -1230,7 +1466,7 @@

Returns

Expand source code
def availability(self,
-                 distribution: str = 'day',
+                 distribution: str = None,
                  timezone: str = None,
                  filters: dict = None,
                  payload: dict = None,
@@ -1325,7 +1561,7 @@ 

Returns

-def engagement(self, distribution: str = 'day', timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +def engagement(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response

Shows the distribution of chats based on engagement during the specified period.

@@ -1358,7 +1594,7 @@

Returns

Expand source code
def engagement(self,
-               distribution: str = 'day',
+               distribution: str = None,
                timezone: str = None,
                filters: dict = None,
                payload: dict = None,
@@ -1388,8 +1624,136 @@ 

Returns

headers=headers)
+
+def first_response_time(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Shows the average agents' first response time within a licence.

+

Args

+
+
distribution : str
+
Allowed values: hour, day, day-hours, month or year. Defaults to day.
+
timezone : str
+
IANA Time Zone (e.g. America/Phoenix). +Defaults to the requester's timezone. +When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
+
filters : dict
+
If none provided, your report will span the last seven days.
+
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 first_response_time(self,
+                        distribution: str = None,
+                        timezone: str = None,
+                        filters: dict = None,
+                        payload: dict = None,
+                        headers: dict = None) -> httpx.Response:
+    ''' Shows the average agents' first response time within a licence.
+
+    Args:
+        distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
+        timezone (str): IANA Time Zone (e.g. America/Phoenix).
+                        Defaults to the requester's timezone.
+                        When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
+        filters (dict): If none provided, your report will span the last seven days.
+        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}/agents/first_response_time',
+                             json=payload,
+                             headers=headers)
+
+
+
+def greetings_conversion(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal.

+

Args

+
+
distribution : str
+
Allowed values: hour, day, day-hours, month or year. Defaults to day.
+
timezone : str
+
IANA Time Zone (e.g. America/Phoenix). +Defaults to the requester's timezone. +When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
+
filters : dict
+
If none provided, your report will span the last seven days.
+
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 greetings_conversion(self,
+                         distribution: str = None,
+                         timezone: str = None,
+                         filters: dict = None,
+                         payload: dict = None,
+                         headers: dict = None) -> httpx.Response:
+    ''' Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal.
+
+    Args:
+        distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
+        timezone (str): IANA Time Zone (e.g. America/Phoenix).
+                        Defaults to the requester's timezone.
+                        When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
+        filters (dict): If none provided, your report will span the last seven days.
+        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}/chats/greetings_conversion',
+                             json=payload,
+                             headers=headers)
+
+
-def ranking(self, distribution: str = 'day', timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +def ranking(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response

Shows the ratio of good to bad ratings for each operator.

@@ -1422,7 +1786,7 @@

Returns

Expand source code
def ranking(self,
-            distribution: str = 'day',
+            distribution: str = None,
             timezone: str = None,
             filters: dict = None,
             payload: dict = None,
@@ -1453,7 +1817,7 @@ 

Returns

-def ratings(self, distribution: str = 'day', timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +def ratings(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response

Shows the number of rated chats along with their ratings during a specified period of time.

@@ -1486,7 +1850,7 @@

Returns

Expand source code
def ratings(self,
-            distribution: str = 'day',
+            distribution: str = None,
             timezone: str = None,
             filters: dict = None,
             payload: dict = None,
@@ -1516,6 +1880,130 @@ 

Returns

headers=headers)
+
+def response_time(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Shows the average agents' response time within a licence.

+

Args

+
+
distribution : str
+
Allowed values: hour, day, day-hours, month or year. Defaults to day.
+
timezone : str
+
IANA Time Zone (e.g. America/Phoenix). +Defaults to the requester's timezone. +When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
+
filters : dict
+
If none provided, your report will span the last seven days.
+
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 response_time(self,
+                  distribution: str = None,
+                  timezone: str = None,
+                  filters: dict = None,
+                  payload: dict = None,
+                  headers: dict = None) -> httpx.Response:
+    ''' Shows the average agents' response time within a licence.
+
+    Args:
+        distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
+        timezone (str): IANA Time Zone (e.g. America/Phoenix).
+                        Defaults to the requester's timezone.
+                        When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
+        filters (dict): If none provided, your report will span the last seven days.
+        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}/agents/response_time',
+                             json=payload,
+                             headers=headers)
+
+
+
+def surveys(self, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response +
+
+

Returns the number of submitted chat surveys along with the count of specific answers.

+

Args

+
+
timezone : str
+
IANA Time Zone (e.g. America/Phoenix). +Defaults to the requester's timezone. +When the requester's timezone isn't present, then filters.from is parsed to get the timezone.
+
filters : dict
+
If none provided, your report will span the last seven days.
+
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 surveys(self,
+            timezone: str = None,
+            filters: dict = None,
+            payload: dict = None,
+            headers: dict = None) -> httpx.Response:
+    ''' Returns the number of submitted chat surveys along with the count of specific answers.
+
+    Args:
+        timezone (str): IANA Time Zone (e.g. America/Phoenix).
+                        Defaults to the requester's timezone.
+                        When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
+        filters (dict): If none provided, your report will span the last seven days.
+        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}/chats/surveys',
+                             json=payload,
+                             headers=headers)
+
+
def tags(self, distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, headers: dict = None) ‑> httpx.Response
@@ -1843,7 +2331,7 @@

Returns

-def modify_header(self, header: dict) ‑> None +def modify_header(self, header: dict) ‑> NoneType

Modifies provided header in session object.

@@ -1866,7 +2354,7 @@

Args

-def remove_header(self, key: str) ‑> None +def remove_header(self, key: str) ‑> NoneType

Removes provided header from session object.

@@ -1912,12 +2400,16 @@

ReportsAPI3
  • ReportsAPI34

    -
      + @@ -1942,7 +2434,7 @@

      -

      Generated by pdoc 0.10.0.

      +

      Generated by pdoc 0.9.2.

      diff --git a/livechat/reports/client.py b/livechat/reports/client.py index 6951e76..f23ef71 100644 --- a/livechat/reports/client.py +++ b/livechat/reports/client.py @@ -332,7 +332,7 @@ def total_chats(self, headers=headers) def ratings(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -362,7 +362,7 @@ def ratings(self, headers=headers) def ranking(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -392,7 +392,7 @@ def ranking(self, headers=headers) def engagement(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -422,7 +422,7 @@ def engagement(self, headers=headers) def greetings_conversion(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -482,7 +482,7 @@ def surveys(self, # Agents def availability(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -512,7 +512,7 @@ def availability(self, headers=headers) def response_time(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None, @@ -542,7 +542,7 @@ def response_time(self, headers=headers) def first_response_time(self, - distribution: str = 'day', + distribution: str = None, timezone: str = None, filters: dict = None, payload: dict = None,