| @@ 10-34 (lines=25) @@ | ||
| 7 | use WyriHaximus\Travis\Resource\Job as BaseJob; |
|
| 8 | use WyriHaximus\Travis\Resource\JobInterface; |
|
| 9 | ||
| 10 | class Job extends BaseJob |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @return array |
|
| 14 | */ |
|
| 15 | public function annotations(): array |
|
| 16 | { |
|
| 17 | return $this->wait( |
|
| 18 | $this->handleCommand( |
|
| 19 | new BuildAsyncFromSyncCommand(self::HYDRATE_CLASS, $this) |
|
| 20 | )->then(function (JobInterface $job) { |
|
| 21 | return Promise::fromObservable($job->annotations()); |
|
| 22 | }) |
|
| 23 | ); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function refresh() : Job |
|
| 27 | { |
|
| 28 | return $this->wait($this->handleCommand( |
|
| 29 | new BuildAsyncFromSyncCommand(self::HYDRATE_CLASS, $this) |
|
| 30 | )->then(function (JobInterface $job) { |
|
| 31 | return $job->refresh(); |
|
| 32 | })); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 9-38 (lines=30) @@ | ||
| 6 | use WyriHaximus\Travis\Resource\User as BaseUser; |
|
| 7 | use WyriHaximus\Travis\Resource\UserInterface; |
|
| 8 | ||
| 9 | class User extends BaseUser |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @return User |
|
| 13 | */ |
|
| 14 | public function sync() : User |
|
| 15 | { |
|
| 16 | return $this->wait( |
|
| 17 | $this->handleCommand( |
|
| 18 | new BuildAsyncFromSyncCommand(self::HYDRATE_CLASS, $this) |
|
| 19 | )->then(function (UserInterface $user) { |
|
| 20 | return $user->sync(); |
|
| 21 | }) |
|
| 22 | ); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return User |
|
| 27 | */ |
|
| 28 | public function refresh() : User |
|
| 29 | { |
|
| 30 | return $this->wait( |
|
| 31 | $this->handleCommand( |
|
| 32 | new BuildAsyncFromSyncCommand(self::HYDRATE_CLASS, $this) |
|
| 33 | )->then(function (UserInterface $user) { |
|
| 34 | return $user->refresh(); |
|
| 35 | }) |
|
| 36 | ); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||