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