|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace WyriHaximus\Travis\Resource\Sync; |
|
5
|
|
|
|
|
6
|
|
|
use WyriHaximus\ApiClient\Resource\CallAsyncTrait; |
|
7
|
|
|
use WyriHaximus\Travis\Resource\Repository as BaseRepository; |
|
8
|
|
|
use function Clue\React\Block\await; |
|
9
|
|
|
use function React\Promise\resolve; |
|
10
|
|
|
use WyriHaximus\Travis\Resource\RepositoryKeyInterface; |
|
11
|
|
|
|
|
12
|
|
|
class Repository extends BaseRepository |
|
13
|
|
|
{ |
|
14
|
|
|
use CallAsyncTrait; |
|
15
|
|
|
|
|
16
|
|
|
public function builds(): array |
|
17
|
|
|
{ |
|
18
|
|
|
return $this->wait($this->observableToPromise($this->callAsync('builds')->toArray())); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
public function build(int $id): Build |
|
22
|
|
|
{ |
|
23
|
|
|
return $this->wait($this->callAsync('build', $id)); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function commits(): array |
|
27
|
|
|
{ |
|
28
|
|
|
return $this->wait($this->observableToPromise($this->callAsync('commits')->toArray())); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function isActive(): bool |
|
32
|
|
|
{ |
|
33
|
|
|
return $this->wait($this->callAsync('isActive')); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function enable(): Repository |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->wait($this->callAsync('enable')); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function disable(): Repository |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->wait($this->callAsync('disable')); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function branches(): array |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->wait($this->observableToPromise($this->callAsync('branches')->toArray())); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function vars(): array |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->wait($this->observableToPromise($this->callAsync('vars')->toArray())); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function caches(): array |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->wait($this->observableToPromise($this->callAsync('caches')->toArray())); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function key(): RepositoryKeyInterface |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->wait($this->callAsync('key')); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|