@@ 58-69 (lines=12) @@ | ||
55 | return json_decode($response->getBody(), true); |
|
56 | } |
|
57 | ||
58 | public function delete(string $path): array |
|
59 | { |
|
60 | $path = $this->normalizePath($path); |
|
61 | ||
62 | $response = $this->client->post('files/delete', [ |
|
63 | 'json' => [ |
|
64 | 'path' => $path, |
|
65 | ] |
|
66 | ]); |
|
67 | ||
68 | return json_decode($response->getBody(), true); |
|
69 | } |
|
70 | ||
71 | /** |
|
72 | * @param string $path |
|
@@ 93-104 (lines=12) @@ | ||
90 | return $result; |
|
91 | } |
|
92 | ||
93 | public function getMetadata(string $path) |
|
94 | { |
|
95 | $path = $this->normalizePath($path); |
|
96 | ||
97 | $response = $this->client->post('files/get_metadata', [ |
|
98 | 'json' => [ |
|
99 | 'path' => $path, |
|
100 | ] |
|
101 | ]); |
|
102 | ||
103 | return json_decode($response->getBody(), true); |
|
104 | } |
|
105 | ||
106 | public function getFile(string $path) |
|
107 | { |
|
@@ 121-133 (lines=13) @@ | ||
118 | return StreamWrapper::getResource($response->getBody()); |
|
119 | } |
|
120 | ||
121 | public function listContents($path = '', $recursive = false): array |
|
122 | { |
|
123 | $path = $this->normalizePath($path); |
|
124 | ||
125 | $response = $this->client->post('files/list_folder', [ |
|
126 | 'json' => [ |
|
127 | 'path' => $path, |
|
128 | 'recursive' => $recursive, |
|
129 | ] |
|
130 | ]); |
|
131 | ||
132 | return json_decode($response->getBody(), true); |
|
133 | } |
|
134 | ||
135 | public function getTemporaryLink(string $path): string |
|
136 | { |
|
@@ 135-148 (lines=14) @@ | ||
132 | return json_decode($response->getBody(), true); |
|
133 | } |
|
134 | ||
135 | public function getTemporaryLink(string $path): string |
|
136 | { |
|
137 | $path = $this->normalizePath($path); |
|
138 | ||
139 | $response = $this->client->post('files/get_temporary_link', [ |
|
140 | 'json' => [ |
|
141 | 'path' => $path, |
|
142 | ], |
|
143 | ]); |
|
144 | ||
145 | $body = json_decode($response->getBody(), true); |
|
146 | ||
147 | return $body['link']; |
|
148 | } |
|
149 | ||
150 | public function getThumbnail(string $path, string $format = 'jpeg', string $size = 'w64h64'): string |
|
151 | { |