1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace ApiClients\Client\Github\Resource\Async; |
4
|
|
|
|
5
|
|
|
use ApiClients\Client\Github\CommandBus\Command\RefreshCommand; |
6
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\AddLabelCommand; |
7
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\BranchesCommand; |
8
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\CommitsCommand; |
9
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\CommunityHealthCommand; |
10
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\ContentsCommand; |
11
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\LabelsCommand; |
12
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\LanguagesCommand; |
13
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\ReleasesCommand; |
14
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\TagsCommand; |
15
|
|
|
use ApiClients\Client\Github\CommandBus\Command\Repository\WebHooksCommand; |
16
|
|
|
use ApiClients\Client\Github\Resource\Repository as BaseRepository; |
17
|
|
|
use React\Promise\PromiseInterface; |
18
|
|
|
use Rx\Observable; |
19
|
|
|
use Rx\ObservableInterface; |
20
|
|
|
use function ApiClients\Tools\Rx\unwrapObservableFromPromise; |
21
|
|
|
|
22
|
|
|
class Repository extends BaseRepository |
23
|
|
|
{ |
24
|
|
|
public function refresh(): PromiseInterface |
25
|
|
|
{ |
26
|
|
|
return $this->handleCommand( |
27
|
|
|
new RefreshCommand($this) |
28
|
|
|
); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function branches(): ObservableInterface |
32
|
|
|
{ |
33
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
34
|
|
|
new BranchesCommand($this->fullName()) |
35
|
|
|
)); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function commits(): ObservableInterface |
39
|
|
|
{ |
40
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
41
|
|
|
new CommitsCommand($this->fullName()) |
42
|
|
|
)); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function labels(): ObservableInterface |
46
|
|
|
{ |
47
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
48
|
|
|
new LabelsCommand($this->fullName()) |
49
|
|
|
)); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function addLabel(string $name, string $colour): PromiseInterface |
53
|
|
|
{ |
54
|
|
|
return $this->handleCommand( |
55
|
|
|
new AddLabelCommand($this->fullName(), $name, $colour) |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function contents(string $path = '/'): Observable |
60
|
|
|
{ |
61
|
|
|
return unwrapObservableFromPromise( |
62
|
|
|
$this->handleCommand( |
63
|
|
|
new ContentsCommand($this->fullName(), $path) |
64
|
|
|
) |
65
|
|
|
); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function communityHealth(): PromiseInterface |
69
|
|
|
{ |
70
|
|
|
return $this->handleCommand( |
71
|
|
|
new CommunityHealthCommand($this->fullName()) |
72
|
|
|
); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function tags(): ObservableInterface |
76
|
|
|
{ |
77
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
78
|
|
|
new TagsCommand($this->fullName()) |
79
|
|
|
)); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function releases(): ObservableInterface |
83
|
|
|
{ |
84
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
85
|
|
|
new ReleasesCommand($this->fullName()) |
86
|
|
|
)); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function languages(): PromiseInterface |
90
|
|
|
{ |
91
|
|
|
return $this->handleCommand( |
92
|
|
|
new LanguagesCommand($this->fullName()) |
93
|
|
|
); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function webHooks(): ObservableInterface |
97
|
|
|
{ |
98
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
99
|
|
|
new WebHooksCommand($this->fullName()) |
100
|
|
|
)); |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|