Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/Core/Adapter/Pterodactyl/Client/PterodactylFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,38 @@ public function changePermissions(string $serverId, string $root, array $files):
$this->throwClientApiException($response, $response->getStatusCode());
}
}

/**
* @throws TransportExceptionInterface
* @throws ServerExceptionInterface
* @throws RedirectionExceptionInterface
* @throws DecodingExceptionInterface
* @throws ClientExceptionInterface
* @throws PterodactylClientApiException
*/
public function getDownloadUrl(string $serverId, string $filePath): string
{
$response = $this->makeRequest('GET', "servers/$serverId/files/download", [
'query' => ['file' => $filePath],
]);
$data = $this->validateClientResponse($response, 200);

return $data['attributes']['url'];
}

/**
* @throws TransportExceptionInterface
* @throws ServerExceptionInterface
* @throws RedirectionExceptionInterface
* @throws DecodingExceptionInterface
* @throws ClientExceptionInterface
* @throws PterodactylClientApiException
*/
public function getUploadUrl(string $serverId): string
{
$response = $this->makeRequest('GET', "servers/$serverId/files/upload");
$data = $this->validateClientResponse($response, 200);

return $data['attributes']['url'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ public function compressFiles(string $serverId, string $root, array $files): voi
public function decompressFile(string $serverId, string $root, string $file): void;

public function changePermissions(string $serverId, string $root, array $files): void;

public function getDownloadUrl(string $serverId, string $filePath): string;

public function getUploadUrl(string $serverId): string;
}