1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: james |
5
|
|
|
* Date: 26/07/2018 |
6
|
|
|
* Time: 14:55 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace CwsOps\LivePerson\Services; |
10
|
|
|
|
11
|
|
|
use CwsOps\LivePerson\Rest\Request; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class AgentService |
15
|
|
|
* |
16
|
|
|
* @package CwsOps\LivePerson\Services |
17
|
|
|
* @author James Parker <[email protected]> |
18
|
|
|
*/ |
19
|
|
|
class AgentService extends AbstractService |
20
|
|
|
{ |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @throws \CwsOps\LivePerson\Rest\BuilderLockedException |
24
|
|
|
*/ |
25
|
|
|
public function agentStatus() |
26
|
|
|
{ |
27
|
|
|
$this->urlBuilder = $this->request->buildUrl($this->getDomain()) |
28
|
|
|
->setService($this->getService()) |
29
|
|
|
->setAccount($this->config->getAccountId()) |
30
|
|
|
->setAction('agent-view') |
31
|
|
|
->addActionContext('status'); |
32
|
|
|
|
33
|
|
|
$payload = [ |
34
|
|
|
'Status' => ['ONLINE', 'AWAY', 'BACK_SOON', 'OFFLINE'], |
35
|
|
|
'agentGroupIds' => ['992149632'] |
36
|
|
|
|
37
|
|
|
]; |
38
|
|
|
|
39
|
|
|
$this->urlBuilder->build(); |
40
|
|
|
|
41
|
|
|
$this->handle($payload, Request::METHOD_POST); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @throws \CwsOps\LivePerson\Rest\BuilderLockedException |
46
|
|
|
*/ |
47
|
|
|
public function agentSummary() |
48
|
|
|
{ |
49
|
|
|
$this->urlBuilder = $this->request->buildUrl($this->getDomain()) |
50
|
|
|
->setService($this->getService()) |
51
|
|
|
->setAccount($this->config->getAccountId()) |
52
|
|
|
->setAction('agent-view') |
53
|
|
|
->addActionContext('summary'); |
54
|
|
|
|
55
|
|
|
$payload = [ |
56
|
|
|
'agentGroupIds' => ['992149632'] |
57
|
|
|
]; |
58
|
|
|
|
59
|
|
|
$this->urlBuilder->build(); |
60
|
|
|
|
61
|
|
|
$this->handle($payload, Request::METHOD_POST); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Should provide the Live person domain id, this service will query against |
66
|
|
|
* |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
protected function getDomain(): string |
70
|
|
|
{ |
71
|
|
|
return 'msgHist'; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Should provide the Live Person service the service will query against. |
76
|
|
|
* |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
protected function getService(): string |
80
|
|
|
{ |
81
|
|
|
return 'messaging_history'; |
82
|
|
|
} |
83
|
|
|
} |