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