1 | <?php |
||
44 | class Api |
||
45 | { |
||
46 | /** |
||
47 | * Agent resources |
||
48 | * |
||
49 | * @api |
||
50 | * @var Agent |
||
51 | */ |
||
52 | public $agents; |
||
53 | |||
54 | /** |
||
55 | * Company resources |
||
56 | * |
||
57 | * @api |
||
58 | * @var Company |
||
59 | */ |
||
60 | public $companies; |
||
61 | |||
62 | /** |
||
63 | * Contact resources |
||
64 | * |
||
65 | * @api |
||
66 | * @var Contact |
||
67 | */ |
||
68 | public $contacts; |
||
69 | |||
70 | /** |
||
71 | * Group resources |
||
72 | * |
||
73 | * @api |
||
74 | * @var Group |
||
75 | */ |
||
76 | public $groups; |
||
77 | |||
78 | /** |
||
79 | * Ticket resources |
||
80 | * |
||
81 | * @api |
||
82 | * @var Ticket |
||
83 | */ |
||
84 | public $tickets; |
||
85 | |||
86 | /** |
||
87 | * TimeEntry resources |
||
88 | * |
||
89 | * @api |
||
90 | * @var TimeEntry |
||
91 | */ |
||
92 | public $timeEntries; |
||
93 | |||
94 | /** |
||
95 | * Conversation resources |
||
96 | * |
||
97 | * @api |
||
98 | * @var Conversation |
||
99 | */ |
||
100 | public $conversations; |
||
101 | |||
102 | /** |
||
103 | * Category resources |
||
104 | * |
||
105 | * @api |
||
106 | * @var Category |
||
107 | */ |
||
108 | public $categories; |
||
109 | |||
110 | /** |
||
111 | * Forum resources |
||
112 | * |
||
113 | * @api |
||
114 | * @var Forum |
||
115 | */ |
||
116 | public $forums; |
||
117 | |||
118 | /** |
||
119 | * Topic resources |
||
120 | * |
||
121 | * @api |
||
122 | * @var Topic |
||
123 | */ |
||
124 | public $topics; |
||
125 | |||
126 | /** |
||
127 | * Comment resources |
||
128 | * |
||
129 | * @api |
||
130 | * @var Comment |
||
131 | */ |
||
132 | public $comments; |
||
133 | |||
134 | //Admin |
||
135 | |||
136 | /** |
||
137 | * Email Config resources |
||
138 | * |
||
139 | * @api |
||
140 | * @var EmailConfig |
||
141 | */ |
||
142 | public $emailConfigs; |
||
143 | |||
144 | /** |
||
145 | * Access Product resources |
||
146 | * |
||
147 | * @api |
||
148 | * @var Product |
||
149 | */ |
||
150 | public $products; |
||
151 | |||
152 | /** |
||
153 | * Business Hours resources |
||
154 | * |
||
155 | * @api |
||
156 | * @var BusinessHour |
||
157 | */ |
||
158 | public $businessHours; |
||
159 | |||
160 | /** |
||
161 | * SLA Policy resources |
||
162 | * |
||
163 | * @api |
||
164 | * @var SLAPolicy |
||
165 | */ |
||
166 | public $slaPolicies; |
||
167 | |||
168 | /** |
||
169 | * @internal |
||
170 | * @var Client |
||
171 | */ |
||
172 | protected $client; |
||
173 | |||
174 | /** |
||
175 | * @internal |
||
176 | * @var string |
||
177 | */ |
||
178 | private $baseUrl; |
||
179 | |||
180 | /** |
||
181 | * Constructs a new api instance |
||
182 | * |
||
183 | * @api |
||
184 | * @param string $apiKey |
||
185 | * @param string $domain |
||
186 | * @throws Exceptions\InvalidConfigurationException |
||
187 | */ |
||
188 | public function __construct($apiKey, $domain) |
||
201 | |||
202 | |||
203 | /** |
||
204 | * Internal method for handling requests |
||
205 | * |
||
206 | * @internal |
||
207 | * @param $method |
||
208 | * @param $endpoint |
||
209 | * @param array|null $data |
||
210 | * @param array|null $query |
||
211 | * @return mixed|null |
||
212 | * @throws ApiException |
||
213 | * @throws ConflictingStateException |
||
214 | * @throws RateLimitExceededException |
||
215 | * @throws UnsupportedContentTypeException |
||
216 | */ |
||
217 | public function request($method, $endpoint, array $data = null, array $query = null) |
||
262 | |||
263 | /** |
||
264 | * Performs the request |
||
265 | * |
||
266 | * @internal |
||
267 | * |
||
268 | * @param $method |
||
269 | * @param $url |
||
270 | * @param $options |
||
271 | * @return mixed|null |
||
272 | * @throws AccessDeniedException |
||
273 | * @throws ApiException |
||
274 | * @throws AuthenticationException |
||
275 | * @throws ConflictingStateException |
||
276 | */ |
||
277 | private function performRequest($method, $url, $options) { |
||
296 | |||
297 | |||
298 | /** |
||
299 | * @param $apiKey |
||
300 | * @param $domain |
||
301 | * @throws Exceptions\InvalidConfigurationException |
||
302 | * @internal |
||
303 | * |
||
304 | */ |
||
305 | private function validateConstructorArgs($apiKey, $domain) |
||
315 | |||
316 | /** |
||
317 | * @internal |
||
318 | */ |
||
319 | private function setupResources() |
||
344 | } |
||
345 |