@@ 21-30 (lines=10) @@ | ||
18 | /** |
|
19 | * @return ObservableInterface |
|
20 | */ |
|
21 | public function jobs(): ObservableInterface |
|
22 | { |
|
23 | return Promise::toObservable( |
|
24 | $this->handleCommand(new SimpleRequestCommand('builds/' . $this->id())) |
|
25 | )->flatMap(function ($response) { |
|
26 | return Observable::fromArray($response->getBody()->getJson()['jobs']); |
|
27 | })->flatMap(function ($job) { |
|
28 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Job', $job))); |
|
29 | }); |
|
30 | } |
|
31 | ||
32 | /** |
|
33 | * @param int $id |
@@ 46-55 (lines=10) @@ | ||
43 | /** |
|
44 | * @return ObservableInterface |
|
45 | */ |
|
46 | public function annotations(): ObservableInterface |
|
47 | { |
|
48 | return Promise::toObservable( |
|
49 | $this->handleCommand(new SimpleRequestCommand('jobs/' . $this->id() . '/annotations')) |
|
50 | )->flatMap(function ($response) { |
|
51 | return Observable::fromArray($response['annotations']); |
|
52 | })->flatMap(function ($annotation) { |
|
53 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Annotation', $annotation))); |
|
54 | }); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * @return PromiseInterface |
@@ 31-40 (lines=10) @@ | ||
28 | ||
29 | class Repository extends BaseRepository |
|
30 | { |
|
31 | public function builds(): Observable |
|
32 | { |
|
33 | return Promise::toObservable( |
|
34 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
35 | )->flatMap(function (ResponseInterface $response) { |
|
36 | return Observable::fromArray($response->getBody()->getJson()['builds']); |
|
37 | })->flatMap(function (array $build) { |
|
38 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Build', $build))); |
|
39 | }); |
|
40 | } |
|
41 | ||
42 | public function jobs(int $buildId): Observable |
|
43 | { |
|
@@ 67-76 (lines=10) @@ | ||
64 | /** |
|
65 | * @return ObservableInterface |
|
66 | */ |
|
67 | public function commits(): ObservableInterface |
|
68 | { |
|
69 | return Promise::toObservable( |
|
70 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
71 | )->flatMap(function (ResponseInterface $response) { |
|
72 | return Observable::fromArray($response->getBody()->getJson()['commits']); |
|
73 | })->flatMap(function (array $commit) { |
|
74 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Commit', $commit))); |
|
75 | }); |
|
76 | } |
|
77 | ||
78 | public function events(): Observable |
|
79 | { |
|
@@ 187-196 (lines=10) @@ | ||
184 | /** |
|
185 | * @return ObservableInterface |
|
186 | */ |
|
187 | public function branches(): ObservableInterface |
|
188 | { |
|
189 | return Promise::toObservable( |
|
190 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/branches')) |
|
191 | )->flatMap(function (ResponseInterface $response) { |
|
192 | return Observable::fromArray($response->getBody()->getJson()['branches']); |
|
193 | })->flatMap(function (array $branch) { |
|
194 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Branch', $branch))); |
|
195 | }); |
|
196 | } |
|
197 | ||
198 | /** |
|
199 | * @return ObservableInterface |
|
@@ 201-210 (lines=10) @@ | ||
198 | /** |
|
199 | * @return ObservableInterface |
|
200 | */ |
|
201 | public function vars(): ObservableInterface |
|
202 | { |
|
203 | return Promise::toObservable( |
|
204 | $this->handleCommand(new SimpleRequestCommand('settings/env_vars?repository_id=' . $this->id())) |
|
205 | )->flatMap(function (ResponseInterface $response) { |
|
206 | return Observable::fromArray($response->getBody()->getJson()['env_vars']); |
|
207 | })->flatMap(function (array $envVar) { |
|
208 | return Promise::toObservable($this->handleCommand(new HydrateCommand('EnvironmentVariable', $envVar))); |
|
209 | }); |
|
210 | } |
|
211 | ||
212 | /** |
|
213 | * @return ObservableInterface |