| @@ 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 |
|
| @@ 32-41 (lines=10) @@ | ||
| 29 | ||
| 30 | class Repository extends BaseRepository |
|
| 31 | { |
|
| 32 | public function builds(): Observable |
|
| 33 | { |
|
| 34 | return Promise::toObservable( |
|
| 35 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
| 36 | )->flatMap(function (ResponseInterface $response) { |
|
| 37 | return Observable::fromArray($response->getBody()->getJson()['builds']); |
|
| 38 | })->flatMap(function (array $build) { |
|
| 39 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Build', $build))); |
|
| 40 | }); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function jobs(int $buildId): Observable |
|
| 44 | { |
|
| @@ 68-77 (lines=10) @@ | ||
| 65 | /** |
|
| 66 | * @return ObservableInterface |
|
| 67 | */ |
|
| 68 | public function commits(): ObservableInterface |
|
| 69 | { |
|
| 70 | return Promise::toObservable( |
|
| 71 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
| 72 | )->flatMap(function (ResponseInterface $response) { |
|
| 73 | return Observable::fromArray($response->getBody()->getJson()['commits']); |
|
| 74 | })->flatMap(function (array $commit) { |
|
| 75 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Commit', $commit))); |
|
| 76 | }); |
|
| 77 | } |
|
| 78 | ||
| 79 | public function events(): Observable |
|
| 80 | { |
|
| @@ 188-197 (lines=10) @@ | ||
| 185 | /** |
|
| 186 | * @return ObservableInterface |
|
| 187 | */ |
|
| 188 | public function branches(): ObservableInterface |
|
| 189 | { |
|
| 190 | return Promise::toObservable( |
|
| 191 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/branches')) |
|
| 192 | )->flatMap(function (ResponseInterface $response) { |
|
| 193 | return Observable::fromArray($response->getBody()->getJson()['branches']); |
|
| 194 | })->flatMap(function (array $branch) { |
|
| 195 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Branch', $branch))); |
|
| 196 | }); |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * @return ObservableInterface |
|