1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: Matt |
5
|
|
|
* Date: 20/04/2016 |
6
|
|
|
* Time: 2:32 PM |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Freshdesk\Resources; |
10
|
|
|
|
11
|
|
|
use Freshdesk\Resources\Traits\AllTrait; |
12
|
|
|
use Freshdesk\Resources\Traits\CreateTrait; |
13
|
|
|
use Freshdesk\Resources\Traits\DeleteTrait; |
14
|
|
|
use Freshdesk\Resources\Traits\UpdateTrait; |
15
|
|
|
use Freshdesk\Resources\Traits\ViewTrait; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class ContactApi |
19
|
|
|
* @internal |
20
|
|
|
* @package Freshdesk |
21
|
|
|
*/ |
22
|
|
|
class Contact extends AbstractResource |
23
|
|
|
{ |
24
|
|
|
use AllTrait, CreateTrait, ViewTrait, UpdateTrait, DeleteTrait; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* The resource endpoint |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
protected $endpoint = '/contacts'; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* List contact fields |
35
|
|
|
* |
36
|
|
|
* @param array|null $query |
37
|
|
|
* @return array|null |
38
|
|
|
* @throws \Freshdesk\Exceptions\AccessDeniedException |
39
|
|
|
* @throws \Freshdesk\Exceptions\ApiException |
40
|
|
|
* @throws \Freshdesk\Exceptions\AuthenticationException |
41
|
|
|
* @throws \Freshdesk\Exceptions\ConflictingStateException |
42
|
|
|
* @throws \Freshdesk\Exceptions\NotFoundException |
43
|
|
|
* @throws \Freshdesk\Exceptions\RateLimitExceededException |
44
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedContentTypeException |
45
|
|
|
* @throws \Freshdesk\Exceptions\MethodNotAllowedException |
46
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedAcceptHeaderException |
47
|
|
|
* @throws \Freshdesk\Exceptions\ValidationException |
48
|
|
|
*/ |
49
|
|
|
public function fields(array $query = null) |
50
|
|
|
{ |
51
|
|
|
return $this->api->request('GET', '/contact_fields', null, $query); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Convert a contact into an agent |
56
|
|
|
* |
57
|
|
|
* @param array|null $query |
58
|
|
|
* @return array|null |
59
|
|
|
* @throws \Freshdesk\Exceptions\AccessDeniedException |
60
|
|
|
* @throws \Freshdesk\Exceptions\ApiException |
61
|
|
|
* @throws \Freshdesk\Exceptions\AuthenticationException |
62
|
|
|
* @throws \Freshdesk\Exceptions\ConflictingStateException |
63
|
|
|
* @throws \Freshdesk\Exceptions\NotFoundException |
64
|
|
|
* @throws \Freshdesk\Exceptions\RateLimitExceededException |
65
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedContentTypeException |
66
|
|
|
* @throws \Freshdesk\Exceptions\MethodNotAllowedException |
67
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedAcceptHeaderException |
68
|
|
|
* @throws \Freshdesk\Exceptions\ValidationException |
69
|
|
|
*/ |
70
|
|
|
public function makeAgent($id, array $query = null) |
71
|
|
|
{ |
72
|
|
|
$end = $id . '/make_agent'; |
73
|
|
|
|
74
|
|
|
return $this->api->request('GET', $this->endpoint($end), null, $query); |
75
|
|
|
} |
76
|
|
|
} |