gitea/src/a68d1841-65bb-41c8-ac09-cfd.../code.power

69 lines
1.7 KiB
Plaintext

/**
* Start stopwatch on an issue.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function start(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/start";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 201, 'success'
);
}
/**
* Stop an issue's existing stopwatch.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function stop(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/stop";
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), ''
), 201, 'success'
);
}
/**
* Delete an issue's existing stopwatch.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
*
* @return string
* @since 3.2.0
**/
public function delete(string $owner, string $repo, int $index): string
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/stopwatch/delete";
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path)
), 204, 'success'
);
}