|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace ApiClients\Client\Github\Resource\Async\Repository; |
|
4
|
|
|
|
|
5
|
|
|
use ApiClients\Client\Github\CommandBus\Command\RefreshCommand; |
|
6
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\Commit\ChecksCommand; |
|
7
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\Commit\CreateStatusCommand; |
|
8
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\Commit\StatusCommand; |
|
9
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\Commit\StatusesCommand; |
|
10
|
|
|
use ApiClients\Client\Github\Resource\Repository\Commit as BaseCommit; |
|
11
|
|
|
use function ApiClients\Tools\Rx\unwrapObservableFromPromise; |
|
12
|
|
|
use React\Promise\PromiseInterface; |
|
13
|
|
|
use Rx\ObservableInterface; |
|
14
|
|
|
|
|
15
|
|
|
class Commit extends BaseCommit |
|
16
|
|
|
{ |
|
17
|
|
|
public function refresh(): PromiseInterface |
|
18
|
|
|
{ |
|
19
|
|
|
return $this->handleCommand( |
|
20
|
|
|
new RefreshCommand($this) |
|
21
|
|
|
); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function status(): PromiseInterface |
|
25
|
|
|
{ |
|
26
|
|
|
return $this->handleCommand( |
|
27
|
|
|
new StatusCommand($this) |
|
28
|
|
|
); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function statuses(): ObservableInterface |
|
32
|
|
|
{ |
|
33
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
|
34
|
|
|
new StatusesCommand($this) |
|
35
|
|
|
)); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function checks(): ObservableInterface |
|
39
|
|
|
{ |
|
40
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
|
41
|
|
|
new ChecksCommand($this) |
|
42
|
|
|
)); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function createStatus(string $state, ?string $targetUrl = null, ?string $description = null, ?string $context = null): PromiseInterface |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->handleCommand( |
|
48
|
|
|
new CreateStatusCommand($this, $state, $targetUrl, $description, $context) |
|
49
|
|
|
); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|