1 | <?php |
||
9 | class Response |
||
10 | { |
||
11 | /** @var \Spatie\SlashCommand\Request */ |
||
12 | protected $request; |
||
13 | |||
14 | /** @var string */ |
||
15 | protected $text; |
||
16 | |||
17 | /** @var string */ |
||
18 | protected $responseType; |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $channel; |
||
22 | |||
23 | /** @var string */ |
||
24 | protected $icon = ''; |
||
25 | |||
26 | /** @var \Illuminate\Support\Collection */ |
||
27 | protected $attachments; |
||
28 | |||
29 | /** @var \GuzzleHttp\Client */ |
||
30 | protected $client; |
||
31 | |||
32 | public static function create(Request $request): self |
||
38 | |||
39 | public function __construct(Client $client, Request $request) |
||
51 | |||
52 | /** |
||
53 | * @param string $text |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function withText(string $text) |
||
63 | |||
64 | public function onChannel(string $channelName) |
||
70 | |||
71 | /** |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function displayResponseToUserWhoTypedCommand() |
||
80 | |||
81 | /** |
||
82 | * @param \Spatie\SlashCommand\Attachment $attachment |
||
83 | * |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function withAttachment(Attachment $attachment) |
||
92 | |||
93 | /** |
||
94 | * @param array|\Spatie\SlashCommand\Attachment $attachments |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function withAttachments($attachments) |
||
110 | |||
111 | /** |
||
112 | * @param string $channelName |
||
113 | * |
||
114 | * @return $this |
||
115 | */ |
||
116 | public function displayResponseToEveryoneOnChannel(string $channelName = '') |
||
126 | |||
127 | /** |
||
128 | * Set the icon (either URL or emoji) we will post as. |
||
129 | * |
||
130 | * @param string $icon |
||
131 | * |
||
132 | * @return $this |
||
133 | */ |
||
134 | public function useIcon(string $icon) |
||
140 | |||
141 | public function getIconType(): string |
||
153 | |||
154 | /** |
||
155 | * Send the response to Slack. |
||
156 | */ |
||
157 | public function send() |
||
161 | |||
162 | public function getIlluminateResponse(): IlluminateResponse |
||
166 | |||
167 | protected function getPayload(): array |
||
188 | } |
||
189 |