gitea/src/61ddd1b9-4b74-44bd-a7ee-f74.../code.power

28 lines
813 B
Plaintext

/**
* Set an issue deadline.
*
* @param string $owner The owner name.
* @param string $repo The repo name.
* @param int $index The issue index.
* @param string|null $dueDate The deadline date string in the format YYYY-MM-DD or null to delete the deadline.
*
* @return object
* @since 3.2.0
**/
public function set(string $owner, string $repo, int $index, ?string $dueDate): object
{
// Build the request path.
$path = "/repos/{$owner}/{$repo}/issues/{$index}/deadline";
// Build the request data.
$data = new \stdClass();
$data->due_date = $dueDate;
// Send the post request.
return $this->response->get(
$this->http->post(
$this->uri->get($path), json_encode($data)
)
);
}