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
|
|
|
* Company resource |
19
|
|
|
* |
20
|
|
|
* This provides access to company resources |
21
|
|
|
* |
22
|
|
|
* @package Api\Resources |
23
|
|
|
*/ |
24
|
|
|
class Company extends AbstractResource |
25
|
|
|
{ |
26
|
|
|
|
27
|
|
|
use AllTrait, CreateTrait, ViewTrait, UpdateTrait, DeleteTrait; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The resource endpoint |
31
|
|
|
* |
32
|
|
|
* @internal |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
protected $endpoint = '/companies'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* List resource fields |
39
|
|
|
* |
40
|
|
|
* @api |
41
|
|
|
* @param array|null $query |
42
|
|
|
* @return mixed|null |
43
|
|
|
* @throws \Freshdesk\Exceptions\AccessDeniedException |
44
|
|
|
* @throws \Freshdesk\Exceptions\ApiException |
45
|
|
|
* @throws \Freshdesk\Exceptions\AuthenticationException |
46
|
|
|
* @throws \Freshdesk\Exceptions\ConflictingStateException |
47
|
|
|
* @throws \Freshdesk\Exceptions\NotFoundException |
48
|
|
|
* @throws \Freshdesk\Exceptions\RateLimitExceededException |
49
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedContentTypeException |
50
|
|
|
* @throws \Freshdesk\Exceptions\MethodNotAllowedException |
51
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedAcceptHeaderException |
52
|
|
|
* @throws \Freshdesk\Exceptions\ValidationException |
53
|
|
|
*/ |
54
|
|
|
public function fields(array $query = null) |
55
|
|
|
{ |
56
|
|
|
return $this->api()->request('GET', '/company_fields', null, $query); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Search companies by filter |
61
|
|
|
* |
62
|
|
|
* @api |
63
|
|
|
* @param array|null $query |
64
|
|
|
* @return mixed|null |
65
|
|
|
* @throws \Freshdesk\Exceptions\AccessDeniedException |
66
|
|
|
* @throws \Freshdesk\Exceptions\ApiException |
67
|
|
|
* @throws \Freshdesk\Exceptions\AuthenticationException |
68
|
|
|
* @throws \Freshdesk\Exceptions\ConflictingStateException |
69
|
|
|
* @throws \Freshdesk\Exceptions\NotFoundException |
70
|
|
|
* @throws \Freshdesk\Exceptions\RateLimitExceededException |
71
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedContentTypeException |
72
|
|
|
* @throws \Freshdesk\Exceptions\MethodNotAllowedException |
73
|
|
|
* @throws \Freshdesk\Exceptions\UnsupportedAcceptHeaderException |
74
|
|
|
* @throws \Freshdesk\Exceptions\ValidationException |
75
|
|
|
*/ |
76
|
|
|
public function autocomplete(array $query = null) |
77
|
|
|
{ |
78
|
|
|
return $this->api()->request('GET', $this->endpoint().'/autocomplete', null, $query); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|