|
1
|
|
|
<?php |
|
2
|
|
|
// phpcs:disable Generic.Files.LineLength |
|
3
|
|
|
namespace Commercetools\Core\Builder\Request; |
|
4
|
|
|
|
|
5
|
|
|
use Commercetools\Core\Request\Channels\ChannelByIdGetRequest; |
|
6
|
|
|
use Commercetools\Core\Request\Channels\ChannelCreateRequest; |
|
7
|
|
|
use Commercetools\Core\Model\Channel\ChannelDraft; |
|
8
|
|
|
use Commercetools\Core\Request\Channels\ChannelDeleteRequest; |
|
9
|
|
|
use Commercetools\Core\Model\Channel\Channel; |
|
10
|
|
|
use Commercetools\Core\Request\Channels\ChannelQueryRequest; |
|
11
|
|
|
use Commercetools\Core\Request\Channels\ChannelUpdateRequest; |
|
12
|
|
|
|
|
13
|
|
|
class ChannelRequestBuilder |
|
14
|
|
|
{ |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @link https://docs.commercetools.com/http-api-projects-channels.html#get-channel-by-id |
|
18
|
|
|
* @param string $id |
|
19
|
|
|
* @return ChannelByIdGetRequest |
|
20
|
|
|
*/ |
|
21
|
1 |
|
public function getById($id) |
|
22
|
|
|
{ |
|
23
|
1 |
|
$request = ChannelByIdGetRequest::ofId($id); |
|
24
|
1 |
|
return $request; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @link https://docs.commercetools.com/http-api-projects-channels.html#create-a-channel |
|
29
|
|
|
* @param ChannelDraft $channel |
|
30
|
|
|
* @return ChannelCreateRequest |
|
31
|
|
|
*/ |
|
32
|
1 |
|
public function create(ChannelDraft $channel) |
|
33
|
|
|
{ |
|
34
|
1 |
|
$request = ChannelCreateRequest::ofDraft($channel); |
|
35
|
1 |
|
return $request; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @link https://docs.commercetools.com/http-api-projects-channels.html#delete-channel |
|
40
|
|
|
* @param Channel $channel |
|
41
|
|
|
* @return ChannelDeleteRequest |
|
42
|
|
|
*/ |
|
43
|
1 |
|
public function delete(Channel $channel) |
|
44
|
|
|
{ |
|
45
|
1 |
|
$request = ChannelDeleteRequest::ofIdAndVersion($channel->getId(), $channel->getVersion()); |
|
46
|
1 |
|
return $request; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @link https://docs.commercetools.com/http-api-projects-channels.html#query-channels |
|
51
|
|
|
* |
|
52
|
|
|
* @return ChannelQueryRequest |
|
53
|
|
|
*/ |
|
54
|
1 |
|
public function query() |
|
55
|
|
|
{ |
|
56
|
1 |
|
$request = ChannelQueryRequest::of(); |
|
57
|
1 |
|
return $request; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @link https://docs.commercetools.com/http-api-projects-channels.html#update-channel |
|
62
|
|
|
* @param Channel $channel |
|
63
|
|
|
* @return ChannelUpdateRequest |
|
64
|
|
|
*/ |
|
65
|
1 |
|
public function update(Channel $channel) |
|
66
|
|
|
{ |
|
67
|
1 |
|
$request = ChannelUpdateRequest::ofIdAndVersion($channel->getId(), $channel->getVersion()); |
|
68
|
1 |
|
return $request; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @return ChannelRequestBuilder |
|
73
|
|
|
*/ |
|
74
|
|
|
public function of() |
|
75
|
|
|
{ |
|
76
|
|
|
return new self(); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|