1 | <?php |
||
19 | class File |
||
20 | { |
||
21 | /** |
||
22 | * @var Client |
||
23 | */ |
||
24 | private $client; |
||
25 | |||
26 | 2 | public function __construct(Client $client) |
|
30 | |||
31 | /** |
||
32 | * Get file |
||
33 | * https://cybozudev.zendesk.com/hc/ja/articles/202166180#step1 |
||
34 | * |
||
35 | * @param string $fileKey |
||
36 | * @param int $guestSpaceId |
||
37 | * @return string |
||
38 | */ |
||
39 | 1 | public function get($fileKey, $guestSpaceId = null): string |
|
46 | |||
47 | /** |
||
48 | * Get file stream response |
||
49 | * https://cybozudev.zendesk.com/hc/ja/articles/202166180#step1 |
||
50 | * |
||
51 | * @param string $fileKey |
||
52 | * @param int $guestSpaceId |
||
53 | * @return ResponseInterface |
||
54 | * @throws RequestException |
||
55 | */ |
||
56 | 2 | public function getStreamResponse($fileKey, $guestSpaceId = null): ResponseInterface |
|
70 | |||
71 | /** |
||
72 | * @param RequestException $result |
||
73 | * @throws RequestException |
||
74 | */ |
||
75 | 1 | private function handleJsonError(RequestException $result): void |
|
85 | |||
86 | /** |
||
87 | * @param array $fileKeys |
||
88 | * @param int|null $guestSpaceId |
||
89 | * @return array [contents, contents, ...] The order of $fileKeys |
||
90 | */ |
||
91 | 1 | public function multiGet(array $fileKeys, $guestSpaceId = null): array |
|
114 | |||
115 | /** |
||
116 | * Post file |
||
117 | * https://cybozudev.zendesk.com/hc/ja/articles/201941824#step1 |
||
118 | * |
||
119 | * @param string $path |
||
120 | * @param int|null $guestSpaceId |
||
121 | * @param string|null $filename |
||
122 | * @return string |
||
123 | */ |
||
124 | 2 | public function post($path, $guestSpaceId = null, $filename = null): string |
|
136 | |||
137 | /** |
||
138 | * @param array $fileNames |
||
139 | * @param int|null $guestSpaceId |
||
140 | * @return array [fileKey, fileKey, ...] The order of $fileNames |
||
141 | * @throws \InvalidArgumentException |
||
142 | */ |
||
143 | 1 | public function multiPost(array $fileNames, $guestSpaceId = null): array |
|
170 | |||
171 | /** |
||
172 | * Returns locale independent base name of the given path. |
||
173 | * |
||
174 | * @param string $name The new file name |
||
175 | * @return string containing |
||
176 | */ |
||
177 | 12 | public static function getFilename($name): string |
|
185 | |||
186 | 3 | private function changeLocale(): void |
|
193 | |||
194 | /** |
||
195 | * @param string $path |
||
196 | * @param string|null $filename |
||
197 | * @return array |
||
198 | */ |
||
199 | 3 | private static function createMultipart($path, $filename = null): array |
|
208 | } |
||
209 |