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\User\OrganizationsCommand; |
7
|
|
|
use ApiClients\Client\Github\CommandBus\Command\User\RepositoriesCommand; |
8
|
|
|
use ApiClients\Client\Github\CommandBus\Command\User\RepositoryCommand; |
9
|
|
|
use ApiClients\Client\Github\CommandBus\Command\WebHooksCommand; |
10
|
|
|
use ApiClients\Client\Github\Resource\Organization as BaseOrganization; |
11
|
|
|
use React\Promise\PromiseInterface; |
12
|
|
|
use Rx\ObservableInterface; |
13
|
|
|
use function ApiClients\Tools\Rx\unwrapObservableFromPromise; |
14
|
|
|
|
15
|
|
|
class Organization extends BaseOrganization |
16
|
|
|
{ |
17
|
|
|
public function refresh(): PromiseInterface |
18
|
|
|
{ |
19
|
|
|
return $this->handleCommand( |
20
|
|
|
new RefreshCommand($this) |
21
|
|
|
); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function repository(string $repository): PromiseInterface |
25
|
|
|
{ |
26
|
|
|
return $this->handleCommand( |
27
|
|
|
new RepositoryCommand($this->login(), $repository) |
28
|
|
|
); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function repositories(): ObservableInterface |
32
|
|
|
{ |
33
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
34
|
|
|
new RepositoriesCommand($this->login()) |
35
|
|
|
)); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function organizations(): ObservableInterface |
39
|
|
|
{ |
40
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
41
|
|
|
new OrganizationsCommand($this->login()) |
42
|
|
|
)); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function webHooks(): ObservableInterface |
46
|
|
|
{ |
47
|
|
|
return unwrapObservableFromPromise($this->handleCommand( |
48
|
|
|
new WebHooksCommand($this->login(), 'orgs') |
49
|
|
|
)); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|