Add support for compressing items in the file manager

This commit is contained in:
Dane Everitt 2020-07-11 13:38:49 -07:00
parent cb9eb918b2
commit 82bc9e617b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 137 additions and 33 deletions

View file

@ -167,4 +167,28 @@ class DaemonFileRepository extends DaemonRepository
]
);
}
/**
* Compress the given files or folders in the given root.
*
* @param string|null $root
* @param array $files
* @return array
*/
public function compressFiles(?string $root, array $files): array
{
Assert::isInstanceOf($this->server, Server::class);
$response = $this->getHttpClient()->post(
sprintf('/api/servers/%s/files/compress', $this->server->uuid),
[
'json' => [
'root' => $root ?? '/',
'files' => $files,
],
]
);
return json_decode($response->getBody(), true);
}
}