Skip to content

Commit 55967b0

Browse files
committed
Added new methods related to greetings conversion, chat surveys, and response time in reports-api v3.4.
1 parent c81ba92 commit 55967b0

File tree

3 files changed

+125
-1
lines changed

3 files changed

+125
-1
lines changed

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [0.1.10] - 2021-12-xx
5+
6+
### Added
7+
8+
- Added new methods related to greetings conversion, chat surveys, and response time in reports-api v3.4.
9+
410
## [0.1.9] - 2021-11-03
511

612
### Added

livechat/reports/client.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,64 @@ def engagement(self,
421421
json=payload,
422422
headers=headers)
423423

424+
def greetings_conversion(self,
425+
distribution: str = 'day',
426+
timezone: str = None,
427+
filters: dict = None,
428+
payload: dict = None,
429+
headers: dict = None) -> httpx.Response:
430+
''' Shows the number of greetings sent to the customers and how many of those resulted in a chat or a goal.
431+
432+
Args:
433+
distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
434+
timezone (str): IANA Time Zone (e.g. America/Phoenix).
435+
Defaults to the requester's timezone.
436+
When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
437+
filters (dict): If none provided, your report will span the last seven days.
438+
payload (dict): Custom payload to be used as request's data.
439+
It overrides all other parameters provided for the method.
440+
headers (dict): Custom headers to be used with session headers.
441+
They will be merged with session-level values that are set,
442+
however, these method-level parameters will not be persisted across requests.
443+
444+
Returns:
445+
httpx.Response: The Response object from `httpx` library,
446+
which contains a server’s response to an HTTP request.
447+
'''
448+
if payload is None:
449+
payload = prepare_payload(locals())
450+
return self.session.post(f'{self.api_url}/chats/greetings_conversion',
451+
json=payload,
452+
headers=headers)
453+
454+
def surveys(self,
455+
timezone: str = None,
456+
filters: dict = None,
457+
payload: dict = None,
458+
headers: dict = None) -> httpx.Response:
459+
''' Returns the number of submitted chat surveys along with the count of specific answers.
460+
461+
Args:
462+
timezone (str): IANA Time Zone (e.g. America/Phoenix).
463+
Defaults to the requester's timezone.
464+
When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
465+
filters (dict): If none provided, your report will span the last seven days.
466+
payload (dict): Custom payload to be used as request's data.
467+
It overrides all other parameters provided for the method.
468+
headers (dict): Custom headers to be used with session headers.
469+
They will be merged with session-level values that are set,
470+
however, these method-level parameters will not be persisted across requests.
471+
472+
Returns:
473+
httpx.Response: The Response object from `httpx` library,
474+
which contains a server’s response to an HTTP request.
475+
'''
476+
if payload is None:
477+
payload = prepare_payload(locals())
478+
return self.session.post(f'{self.api_url}/chats/surveys',
479+
json=payload,
480+
headers=headers)
481+
424482
# Agents
425483

426484
def availability(self,
@@ -452,3 +510,63 @@ def availability(self,
452510
return self.session.post(f'{self.api_url}/agents/availability',
453511
json=payload,
454512
headers=headers)
513+
514+
def response_time(self,
515+
distribution: str = 'day',
516+
timezone: str = None,
517+
filters: dict = None,
518+
payload: dict = None,
519+
headers: dict = None) -> httpx.Response:
520+
''' Shows the average agents' response time within a licence.
521+
522+
Args:
523+
distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
524+
timezone (str): IANA Time Zone (e.g. America/Phoenix).
525+
Defaults to the requester's timezone.
526+
When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
527+
filters (dict): If none provided, your report will span the last seven days.
528+
payload (dict): Custom payload to be used as request's data.
529+
It overrides all other parameters provided for the method.
530+
headers (dict): Custom headers to be used with session headers.
531+
They will be merged with session-level values that are set,
532+
however, these method-level parameters will not be persisted across requests.
533+
534+
Returns:
535+
httpx.Response: The Response object from `httpx` library,
536+
which contains a server’s response to an HTTP request.
537+
'''
538+
if payload is None:
539+
payload = prepare_payload(locals())
540+
return self.session.post(f'{self.api_url}/agents/response_time',
541+
json=payload,
542+
headers=headers)
543+
544+
def first_response_time(self,
545+
distribution: str = 'day',
546+
timezone: str = None,
547+
filters: dict = None,
548+
payload: dict = None,
549+
headers: dict = None) -> httpx.Response:
550+
''' Shows the average agents' first response time within a licence.
551+
552+
Args:
553+
distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
554+
timezone (str): IANA Time Zone (e.g. America/Phoenix).
555+
Defaults to the requester's timezone.
556+
When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
557+
filters (dict): If none provided, your report will span the last seven days.
558+
payload (dict): Custom payload to be used as request's data.
559+
It overrides all other parameters provided for the method.
560+
headers (dict): Custom headers to be used with session headers.
561+
They will be merged with session-level values that are set,
562+
however, these method-level parameters will not be persisted across requests.
563+
564+
Returns:
565+
httpx.Response: The Response object from `httpx` library,
566+
which contains a server’s response to an HTTP request.
567+
'''
568+
if payload is None:
569+
payload = prepare_payload(locals())
570+
return self.session.post(f'{self.api_url}/agents/first_response_time',
571+
json=payload,
572+
headers=headers)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = lc-sdk-python
3-
version = 0.1.9
3+
version = 0.1.10
44
description = Package which lets to work with LiveChat API.
55
long_description = file: README.md
66
long_description_content_type = text/markdown

0 commit comments

Comments
 (0)