VoiceAgents.php
1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace Zendesk\API;
/**
* The VoiceAgents class exposes methods as outlined in http://developer.zendesk.com/documentation/rest_api/voice_integration.html
* @package Zendesk\API
*/
class VoiceAgents extends ClientAbstract
{
/**
* Opens a user's profile in an agent's browser
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return bool
*/
public function openUserProfile(array $params = array())
{
if (!$this->hasKeys($params, array('agent_id', 'user_id'))) {
throw new MissingParametersException(__METHOD__, array('agent_id', 'user_id'));
}
$endPoint = Http::prepare('channels/voice/agents/' . $params['agent_id'] . '/users/' . $params['user_id'] . '/display.json');
$response = Http::send($this->client, $endPoint, null, 'POST');
if ((!is_object($response)) || ($this->client->getDebug()->lastResponseCode != 200)) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return true;
}
/**
* Opens a ticket in an agent's browser
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return bool
*/
public function openTicket(array $params = array())
{
if (!$this->hasKeys($params, array('agent_id', 'ticket_id'))) {
throw new MissingParametersException(__METHOD__, array('agent_id', 'ticket_id'));
}
$endPoint = Http::prepare('channels/voice/agents/' . $params['agent_id'] . '/tickets/' . $params['ticket_id'] . '/display.json');
$response = Http::send($this->client, $endPoint, null, 'POST');
if (($this->client->getDebug()->lastResponseCode != 200)) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return true;
}
}