Add support for file copy and deletion

This commit is contained in:
Dane Everitt 2019-05-04 17:26:24 -07:00
parent 811026895b
commit d79fe6982f
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
12 changed files with 173 additions and 53 deletions

View file

@ -106,4 +106,40 @@ class FileRepository extends BaseWingsRepository implements FileRepositoryInterf
]
);
}
/**
* Copy a given file and give it a unique name.
*
* @param string $location
* @return \Psr\Http\Message\ResponseInterface
*/
public function copyFile(string $location): ResponseInterface
{
return $this->getHttpClient()->post(
sprintf('/api/servers/%s/files/copy', $this->getServer()->uuid),
[
'json' => [
'location' => $location,
],
]
);
}
/**
* Delete a file or folder for the server.
*
* @param string $location
* @return \Psr\Http\Message\ResponseInterface
*/
public function deleteFile(string $location): ResponseInterface
{
return $this->getHttpClient()->post(
sprintf('/api/servers/%s/files/delete', $this->getServer()->uuid),
[
'json' => [
'location' => $location,
],
]
);
}
}