1 | <?php |
||
8 | class SlashCommandResponse |
||
9 | { |
||
10 | /** @var \Spatie\SlashCommand\SlashCommandData */ |
||
11 | protected $slashCommandData; |
||
12 | |||
13 | /** @var string */ |
||
14 | protected $text; |
||
15 | |||
16 | /** @var string */ |
||
17 | protected $responseType = 'ephemeral'; |
||
18 | |||
19 | /** @var string */ |
||
20 | protected $channel; |
||
21 | |||
22 | /** @var string */ |
||
23 | protected $attachments = ''; |
||
24 | |||
25 | /** @var \GuzzleHttp\Client */ |
||
26 | protected $client; |
||
27 | |||
28 | public static function create(SlashCommandData $slashCommandData): SlashCommandResponse |
||
35 | |||
36 | public function __construct(Client $client, SlashCommandData $slashCommandData) |
||
44 | |||
45 | /** |
||
46 | * @param string $text |
||
47 | * |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function setText(string $text) |
||
56 | |||
57 | public function onChannel(string $channelName) |
||
63 | |||
64 | /** |
||
65 | * @return $this |
||
66 | */ |
||
67 | public function displayResponseOnlyToUserWhoTypedCommand() |
||
73 | |||
74 | /** |
||
75 | * @return $this |
||
76 | */ |
||
77 | public function displayResponseToEveryoneOnChannel() |
||
83 | |||
84 | /** |
||
85 | * Send the response to Slack. |
||
86 | */ |
||
87 | public function send() |
||
91 | |||
92 | /* |
||
93 | * Get the http response |
||
94 | */ |
||
95 | public function getHttpResponse(): Response |
||
99 | |||
100 | protected function getPayload(): array |
||
113 | } |
||
114 |