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