1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Traits; |
6
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Exception\ResponseException; |
8
|
|
|
use TgBotApi\BotApiBase\Method\Interfaces\SetMethodAliasInterface; |
9
|
|
|
use TgBotApi\BotApiBase\Method\SetChatDescriptionMethod; |
10
|
|
|
use TgBotApi\BotApiBase\Method\SetChatPermissionsMethod; |
11
|
|
|
use TgBotApi\BotApiBase\Method\SetChatPhotoMethod; |
12
|
|
|
use TgBotApi\BotApiBase\Method\SetChatStickerSetMethod; |
13
|
|
|
use TgBotApi\BotApiBase\Method\SetChatTitleMethod; |
14
|
|
|
use TgBotApi\BotApiBase\Method\SetGameScoreMethod; |
15
|
|
|
use TgBotApi\BotApiBase\Method\SetPassportDataErrorsMethod; |
16
|
|
|
use TgBotApi\BotApiBase\Method\SetStickerPositionInSetMethod; |
17
|
|
|
use TgBotApi\BotApiBase\Method\SetWebhookMethod; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Trait SetMethodTrait. |
21
|
|
|
*/ |
22
|
|
|
trait SetMethodTrait |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @param SetMethodAliasInterface $method |
26
|
|
|
* |
27
|
|
|
* @throws ResponseException |
28
|
|
|
* |
29
|
|
|
* @return bool |
30
|
|
|
*/ |
31
|
|
|
abstract public function set(SetMethodAliasInterface $method): bool; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param SetChatDescriptionMethod $method |
35
|
|
|
* |
36
|
|
|
* @throws ResponseException |
37
|
|
|
* |
38
|
|
|
* @return bool |
39
|
|
|
*/ |
40
|
1 |
|
public function setChatDescription(SetChatDescriptionMethod $method): bool |
41
|
|
|
{ |
42
|
1 |
|
return $this->set($method); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param SetChatPhotoMethod $method |
47
|
|
|
* |
48
|
|
|
* @throws ResponseException |
49
|
|
|
* |
50
|
|
|
* @return bool |
51
|
|
|
*/ |
52
|
1 |
|
public function setChatPhoto(SetChatPhotoMethod $method): bool |
53
|
|
|
{ |
54
|
1 |
|
return $this->set($method); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param SetChatStickerSetMethod $method |
59
|
|
|
* |
60
|
|
|
* @throws ResponseException |
61
|
|
|
* |
62
|
|
|
* @return bool |
63
|
|
|
*/ |
64
|
1 |
|
public function setChatStickerSet(SetChatStickerSetMethod $method): bool |
65
|
|
|
{ |
66
|
1 |
|
return $this->set($method); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param SetChatTitleMethod $method |
71
|
|
|
* |
72
|
|
|
* @throws ResponseException |
73
|
|
|
* |
74
|
|
|
* @return bool |
75
|
|
|
*/ |
76
|
1 |
|
public function setChatTitle(SetChatTitleMethod $method): bool |
77
|
|
|
{ |
78
|
1 |
|
return $this->set($method); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param SetGameScoreMethod $method |
83
|
|
|
* |
84
|
|
|
* @throws ResponseException |
85
|
|
|
* |
86
|
|
|
* @return bool |
87
|
|
|
*/ |
88
|
2 |
|
public function setGameScore(SetGameScoreMethod $method): bool |
89
|
|
|
{ |
90
|
2 |
|
return $this->set($method); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param SetStickerPositionInSetMethod $method |
95
|
|
|
* |
96
|
|
|
* @throws ResponseException |
97
|
|
|
* |
98
|
|
|
* @return bool |
99
|
|
|
*/ |
100
|
1 |
|
public function setStickerPositionInSet(SetStickerPositionInSetMethod $method): bool |
101
|
|
|
{ |
102
|
1 |
|
return $this->set($method); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @param SetWebhookMethod $method |
107
|
|
|
* |
108
|
|
|
* @throws ResponseException |
109
|
|
|
* |
110
|
|
|
* @return bool |
111
|
|
|
*/ |
112
|
1 |
|
public function setWebhook(SetWebhookMethod $method): bool |
113
|
|
|
{ |
114
|
1 |
|
return $this->set($method); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @param SetPassportDataErrorsMethod $method |
119
|
|
|
* |
120
|
|
|
* @throws ResponseException |
121
|
|
|
* |
122
|
|
|
* @return bool |
123
|
|
|
*/ |
124
|
9 |
|
public function setPassportDataErrors(SetPassportDataErrorsMethod $method): bool |
125
|
|
|
{ |
126
|
9 |
|
return $this->set($method); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param SetChatPermissionsMethod $method |
131
|
|
|
* |
132
|
|
|
* @throws ResponseException |
133
|
|
|
* |
134
|
|
|
* @return bool |
135
|
|
|
*/ |
136
|
1 |
|
public function setChatPermissions(SetChatPermissionsMethod $method): bool |
137
|
|
|
{ |
138
|
1 |
|
return $this->set($method); |
139
|
|
|
} |
140
|
|
|
} |
141
|
|
|
|