8
8
from livechat .utils .http_client import HttpClient
9
9
from livechat .utils .structures import AccessToken
10
10
11
+ # pylint: disable=unused-argument,too-many-arguments
12
+
11
13
12
14
class ReportsApiV36 (HttpClient ):
13
15
''' Reports API client class in version 3.6. '''
@@ -47,7 +49,7 @@ def duration(self,
47
49
48
50
Returns:
49
51
httpx.Response: The Response object from `httpx` library,
50
- which contains a server’ s response to an HTTP request.
52
+ which contains a server' s response to an HTTP request.
51
53
'''
52
54
if payload is None :
53
55
payload = prepare_payload (locals ())
@@ -77,7 +79,7 @@ def tags(self,
77
79
78
80
Returns:
79
81
httpx.Response: The Response object from `httpx` library,
80
- which contains a server’ s response to an HTTP request.
82
+ which contains a server' s response to an HTTP request.
81
83
'''
82
84
if payload is None :
83
85
payload = prepare_payload (locals ())
@@ -107,7 +109,7 @@ def total_chats(self,
107
109
108
110
Returns:
109
111
httpx.Response: The Response object from `httpx` library,
110
- which contains a server’ s response to an HTTP request.
112
+ which contains a server' s response to an HTTP request.
111
113
'''
112
114
if payload is None :
113
115
payload = prepare_payload (locals ())
@@ -137,7 +139,7 @@ def ratings(self,
137
139
138
140
Returns:
139
141
httpx.Response: The Response object from `httpx` library,
140
- which contains a server’ s response to an HTTP request.
142
+ which contains a server' s response to an HTTP request.
141
143
'''
142
144
if payload is None :
143
145
payload = prepare_payload (locals ())
@@ -167,7 +169,7 @@ def ranking(self,
167
169
168
170
Returns:
169
171
httpx.Response: The Response object from `httpx` library,
170
- which contains a server’ s response to an HTTP request.
172
+ which contains a server' s response to an HTTP request.
171
173
'''
172
174
if payload is None :
173
175
payload = prepare_payload (locals ())
@@ -197,7 +199,7 @@ def engagement(self,
197
199
198
200
Returns:
199
201
httpx.Response: The Response object from `httpx` library,
200
- which contains a server’ s response to an HTTP request.
202
+ which contains a server' s response to an HTTP request.
201
203
'''
202
204
if payload is None :
203
205
payload = prepare_payload (locals ())
@@ -227,7 +229,7 @@ def greetings_conversion(self,
227
229
228
230
Returns:
229
231
httpx.Response: The Response object from `httpx` library,
230
- which contains a server’ s response to an HTTP request.
232
+ which contains a server' s response to an HTTP request.
231
233
'''
232
234
if payload is None :
233
235
payload = prepare_payload (locals ())
@@ -255,7 +257,7 @@ def surveys(self,
255
257
256
258
Returns:
257
259
httpx.Response: The Response object from `httpx` library,
258
- which contains a server’ s response to an HTTP request.
260
+ which contains a server' s response to an HTTP request.
259
261
'''
260
262
if payload is None :
261
263
payload = prepare_payload (locals ())
@@ -285,7 +287,7 @@ def response_time(self,
285
287
286
288
Returns:
287
289
httpx.Response: The Response object from `httpx` library,
288
- which contains a server’ s response to an HTTP request.
290
+ which contains a server' s response to an HTTP request.
289
291
'''
290
292
if payload is None :
291
293
payload = prepare_payload (locals ())
@@ -315,14 +317,104 @@ def first_response_time(self,
315
317
316
318
Returns:
317
319
httpx.Response: The Response object from `httpx` library,
318
- which contains a server’ s response to an HTTP request.
320
+ which contains a server' s response to an HTTP request.
319
321
'''
320
322
if payload is None :
321
323
payload = prepare_payload (locals ())
322
324
return self .session .post (f'{ self .api_url } /chats/first_response_time' ,
323
325
json = payload ,
324
326
headers = headers )
325
327
328
+ def groups (self ,
329
+ distribution : str = None ,
330
+ timezone : str = None ,
331
+ filters : dict = None ,
332
+ payload : dict = None ,
333
+ headers : dict = None ) -> httpx .Response :
334
+ ''' Shows the total number of chats handled by each group during the specified period.
335
+
336
+ Args:
337
+ distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
338
+ timezone (str): IANA Time Zone (e.g. America/Phoenix).
339
+ Defaults to the requester's timezone.
340
+ When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
341
+ filters (dict): If none provided, your report will span the last seven days.
342
+ payload (dict): Custom payload to be used as request's data.
343
+ It overrides all other parameters provided for the method.
344
+ headers (dict): Custom headers to be used with session headers.
345
+ They will be merged with session-level values that are set,
346
+ however, these method-level parameters will not be persisted across requests.
347
+
348
+ Returns:
349
+ httpx.Response: The Response object from `httpx` library,
350
+ which contains a server's response to an HTTP request.
351
+ '''
352
+ if payload is None :
353
+ payload = prepare_payload (locals ())
354
+ return self .session .post (f'{ self .api_url } /chats/groups' ,
355
+ json = payload ,
356
+ headers = headers )
357
+
358
+ def queued_visitors (self ,
359
+ distribution : str = None ,
360
+ timezone : str = None ,
361
+ filters : dict = None ,
362
+ payload : dict = None ,
363
+ headers : dict = None ) -> httpx .Response :
364
+ ''' Shows how many customers were waiting in the queue during the specified period.
365
+
366
+ Args:
367
+ distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
368
+ timezone (str): IANA Time Zone (e.g. America/Phoenix).
369
+ Defaults to the requester's timezone.
370
+ When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
371
+ filters (dict): If none provided, your report will span the last seven days.
372
+ payload (dict): Custom payload to be used as request's data.
373
+ It overrides all other parameters provided for the method.
374
+ headers (dict): Custom headers to be used with session headers.
375
+ They will be merged with session-level values that are set,
376
+ however, these method-level parameters will not be persisted across requests.
377
+
378
+ Returns:
379
+ httpx.Response: The Response object from `httpx` library,
380
+ which contains a server's response to an HTTP request.
381
+ '''
382
+ if payload is None :
383
+ payload = prepare_payload (locals ())
384
+ return self .session .post (f'{ self .api_url } /chats/queued_visitors' ,
385
+ json = payload ,
386
+ headers = headers )
387
+
388
+ def queued_visitors_left (self ,
389
+ distribution : str = None ,
390
+ timezone : str = None ,
391
+ filters : dict = None ,
392
+ payload : dict = None ,
393
+ headers : dict = None ) -> httpx .Response :
394
+ ''' Shows customers that left the queue during the specified period.
395
+
396
+ Args:
397
+ distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
398
+ timezone (str): IANA Time Zone (e.g. America/Phoenix).
399
+ Defaults to the requester's timezone.
400
+ When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
401
+ filters (dict): If none provided, your report will span the last seven days.
402
+ payload (dict): Custom payload to be used as request's data.
403
+ It overrides all other parameters provided for the method.
404
+ headers (dict): Custom headers to be used with session headers.
405
+ They will be merged with session-level values that are set,
406
+ however, these method-level parameters will not be persisted across requests.
407
+
408
+ Returns:
409
+ httpx.Response: The Response object from `httpx` library,
410
+ which contains a server's response to an HTTP request.
411
+ '''
412
+ if payload is None :
413
+ payload = prepare_payload (locals ())
414
+ return self .session .post (f'{ self .api_url } /chats/queued_visitors_left' ,
415
+ json = payload ,
416
+ headers = headers )
417
+
326
418
# Agents
327
419
328
420
def availability (self ,
@@ -347,7 +439,7 @@ def availability(self,
347
439
348
440
Returns:
349
441
httpx.Response: The Response object from `httpx` library,
350
- which contains a server’ s response to an HTTP request.
442
+ which contains a server' s response to an HTTP request.
351
443
'''
352
444
if payload is None :
353
445
payload = prepare_payload (locals ())
@@ -377,15 +469,14 @@ def performance(self,
377
469
378
470
Returns:
379
471
httpx.Response: The Response object from `httpx` library,
380
- which contains a server’ s response to an HTTP request.
472
+ which contains a server' s response to an HTTP request.
381
473
'''
382
474
if payload is None :
383
475
payload = prepare_payload (locals ())
384
476
return self .session .post (f'{ self .api_url } /agents/performance' ,
385
477
json = payload ,
386
478
headers = headers )
387
479
388
-
389
480
# Tags
390
481
391
482
def chat_usage (self ,
@@ -408,10 +499,43 @@ def chat_usage(self,
408
499
409
500
Returns:
410
501
httpx.Response: The Response object from `httpx` library,
411
- which contains a server’ s response to an HTTP request.
502
+ which contains a server' s response to an HTTP request.
412
503
'''
413
504
if payload is None :
414
505
payload = prepare_payload (locals ())
415
506
return self .session .post (f'{ self .api_url } /tags/chat_usage' ,
416
507
json = payload ,
417
508
headers = headers )
509
+
510
+
511
+ # Stats
512
+
513
+ def unique_visitors (self ,
514
+ distribution : str = None ,
515
+ timezone : str = None ,
516
+ filters : dict = None ,
517
+ payload : dict = None ,
518
+ headers : dict = None ) -> httpx .Response :
519
+ ''' Shows the total number of page views and unique visitors for the specified period.
520
+
521
+ Args:
522
+ distribution (str): Allowed values: `hour`, `day`, `day-hours`, `month` or `year`. Defaults to `day`.
523
+ timezone (str): IANA Time Zone (e.g. America/Phoenix).
524
+ Defaults to the requester's timezone.
525
+ When the requester's timezone isn't present, then `filters.from` is parsed to get the timezone.
526
+ filters (dict): If none provided, your report will span the last seven days.
527
+ payload (dict): Custom payload to be used as request's data.
528
+ It overrides all other parameters provided for the method.
529
+ headers (dict): Custom headers to be used with session headers.
530
+ They will be merged with session-level values that are set,
531
+ however, these method-level parameters will not be persisted across requests.
532
+
533
+ Returns:
534
+ httpx.Response: The Response object from `httpx` library,
535
+ which contains a server's response to an HTTP request.
536
+ '''
537
+ if payload is None :
538
+ payload = prepare_payload (locals ())
539
+ return self .session .post (f'{ self .api_url } /stats/unique_visitors' ,
540
+ json = payload ,
541
+ headers = headers )
0 commit comments