@@ 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 |
@@ 29-38 (lines=10) @@ | ||
26 | ||
27 | class Repository extends BaseRepository |
|
28 | { |
|
29 | public function builds(): Observable |
|
30 | { |
|
31 | return Promise::toObservable( |
|
32 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
33 | )->flatMap(function (ResponseInterface $response) { |
|
34 | return Observable::fromArray($response->getBody()->getJson()['builds']); |
|
35 | })->flatMap(function (array $build) { |
|
36 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Build', $build))); |
|
37 | }); |
|
38 | } |
|
39 | ||
40 | public function jobs(int $buildId): Observable |
|
41 | { |
|
@@ 65-74 (lines=10) @@ | ||
62 | /** |
|
63 | * @return ObservableInterface |
|
64 | */ |
|
65 | public function commits(): ObservableInterface |
|
66 | { |
|
67 | return Promise::toObservable( |
|
68 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
69 | )->flatMap(function (ResponseInterface $response) { |
|
70 | return Observable::fromArray($response->getBody()->getJson()['commits']); |
|
71 | })->flatMap(function (array $commit) { |
|
72 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Commit', $commit))); |
|
73 | }); |
|
74 | } |
|
75 | ||
76 | public function events(): Observable |
|
77 | { |
|
@@ 185-194 (lines=10) @@ | ||
182 | /** |
|
183 | * @return ObservableInterface |
|
184 | */ |
|
185 | public function branches(): ObservableInterface |
|
186 | { |
|
187 | return Promise::toObservable( |
|
188 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/branches')) |
|
189 | )->flatMap(function (ResponseInterface $response) { |
|
190 | return Observable::fromArray($response->getBody()->getJson()['branches']); |
|
191 | })->flatMap(function (array $branch) { |
|
192 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Branch', $branch))); |
|
193 | }); |
|
194 | } |
|
195 | ||
196 | /** |
|
197 | * @return ObservableInterface |
|
@@ 199-208 (lines=10) @@ | ||
196 | /** |
|
197 | * @return ObservableInterface |
|
198 | */ |
|
199 | public function vars(): ObservableInterface |
|
200 | { |
|
201 | return Promise::toObservable( |
|
202 | $this->handleCommand(new SimpleRequestCommand('settings/env_vars?repository_id=' . $this->id())) |
|
203 | )->flatMap(function (ResponseInterface $response) { |
|
204 | return Observable::fromArray($response->getBody()->getJson()['env_vars']); |
|
205 | })->flatMap(function (array $envVar) { |
|
206 | return Promise::toObservable($this->handleCommand(new HydrateCommand('EnvironmentVariable', $envVar))); |
|
207 | }); |
|
208 | } |
|
209 | ||
210 | /** |
|
211 | * @return ObservableInterface |
|
@@ 213-222 (lines=10) @@ | ||
210 | /** |
|
211 | * @return ObservableInterface |
|
212 | */ |
|
213 | public function caches(): ObservableInterface |
|
214 | { |
|
215 | return Promise::toObservable( |
|
216 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/caches')) |
|
217 | )->flatMap(function (ResponseInterface $response) { |
|
218 | return Observable::fromArray($response->getBody()->getJson()['caches']); |
|
219 | })->flatMap(function (array $cache) { |
|
220 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Cache', $cache))); |
|
221 | }); |
|
222 | } |
|
223 | ||
224 | /** |
|
225 | * @return PromiseInterface |