|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright © Thomas Klein, All rights reserved. |
|
4
|
|
|
* See LICENSE bundled with this library for license details. |
|
5
|
|
|
*/ |
|
6
|
|
|
declare(strict_types=1); |
|
7
|
|
|
|
|
8
|
|
|
namespace Zoho\Desk; |
|
9
|
|
|
|
|
10
|
|
|
use Zoho\Desk\Client\ConfigProviderInterface; |
|
11
|
|
|
use Zoho\Desk\Client\RequestBuilder; |
|
12
|
|
|
use Zoho\Desk\Model\DataObjectFactory; |
|
13
|
|
|
use Zoho\Desk\Model\OperationPool; |
|
14
|
|
|
use Zoho\Desk\OAuth\Client; |
|
15
|
|
|
use Zoho\Desk\Service\ServiceFactory; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @api |
|
19
|
|
|
*/ |
|
20
|
|
|
final class Gateway |
|
21
|
|
|
{ |
|
22
|
|
|
private Client $client; |
|
23
|
|
|
|
|
24
|
|
|
private RequestBuilder $requestBuilder; |
|
25
|
|
|
|
|
26
|
|
|
private DataObjectFactory $dataObjectFactory; |
|
27
|
|
|
|
|
28
|
|
|
private OperationPool $operationPool; |
|
29
|
|
|
|
|
30
|
|
|
private ServiceFactory $serviceFactory; |
|
31
|
|
|
|
|
32
|
|
|
public function __construct(ConfigProviderInterface $configProvider, array $registeredEntityTypes = []) |
|
33
|
|
|
{ |
|
34
|
|
|
$this->client = new Client($configProvider); |
|
35
|
|
|
$this->requestBuilder = new RequestBuilder($this->client); |
|
36
|
|
|
$this->dataObjectFactory = new DataObjectFactory($registeredEntityTypes); |
|
37
|
|
|
$this->operationPool = new OperationPool($this->requestBuilder, $this->dataObjectFactory); |
|
|
|
|
|
|
38
|
|
|
$this->serviceFactory = new ServiceFactory($this->requestBuilder, $this->dataObjectFactory); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function getDataObjectFactory(): DataObjectFactory |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->dataObjectFactory; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @deprecated |
|
48
|
|
|
* @see Gateway::getServiceFactory |
|
49
|
|
|
*/ |
|
50
|
|
|
public function getOperationPool(): OperationPool |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->operationPool; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getServiceFactory(): ServiceFactory |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->serviceFactory; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getClient(): Client |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->client; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getRequestBuilder(): RequestBuilder |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->requestBuilder; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|