gitea/src/8a8fce09-a880-4364-a8c4-4ca.../code.power

32 lines
764 B
Plaintext

/**
* Get an archive of a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $archive The archive format, e.g., "zip" or "tar.gz".
*
* @return string
* @since 3.2.0
**/
public function get(
string $owner,
string $repo,
string $archive
): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/archive/{$archive}";
// Set the required variables to the URI.
$uri = $this->uri->get($path);
$uri->setVar('owner', $owner);
$uri->setVar('repo', $repo);
$uri->setVar('archive', $archive);
// Send the get request.
return $this->response->get(
$this->http->get($uri), 200, 'success'
);
}