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