1 | <?php |
||
17 | class File |
||
18 | { |
||
19 | /** |
||
20 | * @var Client |
||
21 | */ |
||
22 | private $client; |
||
23 | |||
24 | 1 | public function __construct(Client $client) |
|
28 | |||
29 | /** |
||
30 | * Get file |
||
31 | * https://cybozudev.zendesk.com/hc/ja/articles/202166180#step1 |
||
32 | * |
||
33 | * @param string $fileKey |
||
34 | * @param int $guestSpaceId |
||
35 | * @return string |
||
36 | */ |
||
37 | public function get($fileKey, $guestSpaceId = null) |
||
38 | { |
||
39 | $options = ['json' => ['fileKey' => $fileKey]]; |
||
40 | $response = $this->client->get(KintoneApi::generateUrl('file.json', $guestSpaceId), $options); |
||
41 | |||
42 | return (string)$response->getBody(); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param array $fileKeys |
||
47 | * @param int|null $guestSpaceId |
||
48 | * @return array |
||
49 | */ |
||
50 | public function multiGet(array $fileKeys, $guestSpaceId = null) |
||
73 | |||
74 | /** |
||
75 | * Post file |
||
76 | * https://cybozudev.zendesk.com/hc/ja/articles/201941824#step1 |
||
77 | * |
||
78 | * @param string $filename |
||
79 | * @param int $guestSpaceId |
||
80 | * @return string |
||
81 | */ |
||
82 | public function post($filename, $guestSpaceId = null) |
||
94 | |||
95 | /** |
||
96 | * @param array $fileNames |
||
97 | * @param int|null $guestSpaceId |
||
98 | * @return array |
||
99 | * @throws \InvalidArgumentException |
||
100 | */ |
||
101 | public function multiPost(array $fileNames, $guestSpaceId = null) |
||
128 | |||
129 | /** |
||
130 | * Returns locale independent base name of the given path. |
||
131 | * |
||
132 | * @param string $name The new file name |
||
133 | * @return string containing |
||
134 | */ |
||
135 | 9 | public static function getFilename($name) |
|
143 | |||
144 | private function changeLocale() |
||
151 | |||
152 | /** |
||
153 | * @param string $filename |
||
154 | * @return array |
||
155 | */ |
||
156 | private static function createMultipart($filename) |
||
165 | } |