| @@ 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 |
|
| @@ 34-43 (lines=10) @@ | ||
| 31 | ||
| 32 | class Repository extends BaseRepository |
|
| 33 | { |
|
| 34 | public function builds(): Observable |
|
| 35 | { |
|
| 36 | return Promise::toObservable( |
|
| 37 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
| 38 | )->flatMap(function (ResponseInterface $response) { |
|
| 39 | return Observable::fromArray($response->getBody()->getJson()['builds']); |
|
| 40 | })->flatMap(function (array $build) { |
|
| 41 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Build', $build))); |
|
| 42 | }); |
|
| 43 | } |
|
| 44 | ||
| 45 | public function jobs(int $buildId): Observable |
|
| 46 | { |
|
| @@ 70-79 (lines=10) @@ | ||
| 67 | /** |
|
| 68 | * @return ObservableInterface |
|
| 69 | */ |
|
| 70 | public function commits(): ObservableInterface |
|
| 71 | { |
|
| 72 | return Promise::toObservable( |
|
| 73 | $this->handleCommand(new SimpleRequestCommand('repos/' . $this->slug() . '/builds')) |
|
| 74 | )->flatMap(function (ResponseInterface $response) { |
|
| 75 | return Observable::fromArray($response->getBody()->getJson()['commits']); |
|
| 76 | })->flatMap(function (array $commit) { |
|
| 77 | return Promise::toObservable($this->handleCommand(new HydrateCommand('Commit', $commit))); |
|
| 78 | }); |
|
| 79 | } |
|
| 80 | ||
| 81 | public function events(): Observable |
|
| 82 | { |
|