gitea/src/63fbd482-688a-4356-b3e4-a67.../code.power

41 lines
1.2 KiB
Plaintext

/**
* List all comments in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $page The page to get, defaults to 1.
* @param int $limit The number of comments per page, defaults to 10.
* @param string|null $since The date-time string to filter updated comments since, defaults to null.
* @param string|null $before The date-time string to filter updated comments before, defaults to null.
*
* @return array|null
* @since 3.2.0
**/
public function list(string $owner, string $repo, int $page = 1, int $limit = 10, ?string $since = null, ?string $before = null): ?array
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/comments";
// Build the URI.
$uri = $this->uri->get($path);
// Set the URI variables.
$uri->setVar('page', $page);
$uri->setVar('limit', $limit);
if ($since !== null)
{
$uri->setVar('since', $since);
}
if ($before !== null)
{
$uri->setVar('before', $before);
}
// Send the get request.
return $this->response->get(
$this->http->get($uri)
);
}