|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace MovingImage\Client\VMPro\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use MovingImage\Client\VMPro\Util\AccessorTrait; |
|
8
|
|
|
use MovingImage\Meta\Enums\PublicationState; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @method int getVideoId() |
|
12
|
|
|
* @method VideosRequestParameters setVideoId(int $videoId) |
|
13
|
|
|
* @method int setChannelId(int $channelId) |
|
14
|
|
|
* @method int getOffset() |
|
15
|
|
|
* @method VideosRequestParameters setOffset(int $offset) |
|
16
|
|
|
* @method int getLimit() |
|
17
|
|
|
* @method VideosRequestParameters setLimit(int $limit) |
|
18
|
|
|
* @method string getOrder() |
|
19
|
|
|
* @method string getOrderProperty() |
|
20
|
|
|
* @method VideosRequestParameters setOrderProperty(string $orderProperty) |
|
21
|
|
|
* @method string getSearchTerm() |
|
22
|
|
|
* @method VideosRequestParameters setSearchTerm(string $searchTerm) |
|
23
|
|
|
* @method bool isIncludeCustomMetadata() |
|
24
|
|
|
* @method VideosRequestParameters setIncludeCustomMetadata(bool $includeCustomMetadata) |
|
25
|
|
|
* @method string getCustomMetadataField() |
|
26
|
|
|
* @method VideosRequestParameters setCustomMetadataField(int $customMetadataField) |
|
27
|
|
|
* @method string getSearchInField() |
|
28
|
|
|
* @method VideosRequestParameters setSearchInField(string $searchInField) |
|
29
|
|
|
* @method string getPublicationState() |
|
30
|
|
|
* @method bool isIncludeKeywords() |
|
31
|
|
|
* @method VideosRequestParameters setIncludeKeywords(bool $includeKeywords) |
|
32
|
|
|
* @method VideosRequestParameters setIncludeChannelAssignments(bool $includeChannels) |
|
33
|
|
|
* @method bool isIncludeSubChannels() |
|
34
|
|
|
* @method VideosRequestParameters setIncludeSubChannels(bool $includeSubChannels) |
|
35
|
|
|
* @method VideosRequestParameters setMetadataSetKey(string $metadataSetKey) |
|
36
|
|
|
* @method string getMetadataSetKey() |
|
37
|
|
|
*/ |
|
38
|
|
|
class VideosRequestParameters |
|
39
|
|
|
{ |
|
40
|
|
|
use AccessorTrait; |
|
41
|
|
|
|
|
42
|
|
|
public function setOrder(string $order): self |
|
43
|
|
|
{ |
|
44
|
|
|
$pool = ['asc', 'desc']; |
|
45
|
|
|
|
|
46
|
|
|
// Silently ignore wrong values |
|
47
|
|
|
if (in_array($order, $pool)) { |
|
48
|
|
|
$this->container['order'] = $order; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
return $this; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function setPublicationState(string $publicationState): self |
|
55
|
|
|
{ |
|
56
|
|
|
if (in_array($publicationState, PublicationState::getValues())) { |
|
57
|
|
|
$this->container['publication_state'] = $publicationState; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
return $this; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getChannelIds(): array |
|
64
|
|
|
{ |
|
65
|
|
|
if (isset($this->container['channel_id'])) { |
|
66
|
|
|
if (is_array($this->container['channel_id'])) { |
|
67
|
|
|
return $this->container['channel_id']; |
|
68
|
|
|
} else { |
|
69
|
|
|
return [$this->container['channel_id']]; |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
return []; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Return the first element of channelId if it is an array, otherwise return the only channelId |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getChannelId(): ?int |
|
80
|
|
|
{ |
|
81
|
|
|
if (isset($this->container['channel_id'])) { |
|
82
|
|
|
if (is_array($this->container['channel_id']) && isset($this->container['channel_id'][0])) { |
|
83
|
|
|
return $this->container['channel_id'][0]; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
if (!is_array($this->container['channel_id'])) { |
|
87
|
|
|
return $this->container['channel_id']; |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
return null; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public function setChannelIds(array $channelIds): self |
|
95
|
|
|
{ |
|
96
|
|
|
$this->container['channel_id'] = $channelIds; |
|
97
|
|
|
|
|
98
|
|
|
return $this; |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|