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\Service; |
9
|
|
|
|
10
|
|
|
use Zoho\Desk\Client\RequestBuilder; |
11
|
|
|
use Zoho\Desk\Model\DataObjectFactory; |
12
|
|
|
|
13
|
|
|
final class ServiceFactory |
14
|
|
|
{ |
15
|
|
|
private RequestBuilder $requestBuilder; |
16
|
|
|
|
17
|
|
|
private DataObjectFactory $dataObjectFactory; |
18
|
|
|
|
19
|
|
|
public function __construct(RequestBuilder $requestBuilder, DataObjectFactory $dataObjectFactory) |
20
|
|
|
{ |
21
|
|
|
$this->requestBuilder = $requestBuilder; |
22
|
|
|
$this->dataObjectFactory = $dataObjectFactory; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function createOperation(string $entityType, ?string $path = null, array $arguments = []): CreateOperationInterface |
26
|
|
|
{ |
27
|
|
|
return new CreateOperation($this->requestBuilder, $this->dataObjectFactory, $entityType, $path, $arguments); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function readOperation(string $entityType, ?string $path = null, array $arguments = []): ReadOperationInterface |
31
|
|
|
{ |
32
|
|
|
return new ReadOperation($this->requestBuilder, $this->dataObjectFactory, $entityType, $path, $arguments); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function updateOperation(string $entityType, ?string $path = null, array $arguments = []): UpdateOperationInterface |
36
|
|
|
{ |
37
|
|
|
return new UpdateOperation($this->requestBuilder, $this->dataObjectFactory, $entityType, $path, $arguments); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function deleteOperation(string $entityType, ?string $path = null, array $arguments = []): DeleteOperationInterface |
41
|
|
|
{ |
42
|
|
|
return new DeleteOperation($this->requestBuilder, $entityType, $path, $arguments); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function listOperation(string $entityType, ?string $path = null, array $arguments = []): ListOperationInterface |
46
|
|
|
{ |
47
|
|
|
return new ListOperation($this->requestBuilder, $this->dataObjectFactory, $entityType, $path, $arguments); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|