diff --git a/src/AsyncClient.php b/src/AsyncClient.php index 3d27112dfd..686623bbed 100644 --- a/src/AsyncClient.php +++ b/src/AsyncClient.php @@ -151,6 +151,11 @@ public function rateLimit(): PromiseInterface return $this->client->handle(new Command\RateLimitCommand()); } + public function app(): PromiseInterface + { + return $this->client->handle(new Command\AppCommand()); + } + public function renderMarkdown( ReadableStreamInterface $stream, string $mode = 'markdown', diff --git a/src/CommandBus/Command/AppCommand.php b/src/CommandBus/Command/AppCommand.php new file mode 100644 index 0000000000..5ce3ba3098 --- /dev/null +++ b/src/CommandBus/Command/AppCommand.php @@ -0,0 +1,12 @@ +service = $service; + } + + /** + * @param AppCommand $command + * @return PromiseInterface + */ + public function handle(AppCommand $command): PromiseInterface + { + return resolve( + $this->service->fetch( + 'app', + '', + AppInterface::HYDRATE_CLASS + ) + ); + } +} diff --git a/src/Resource/App.php b/src/Resource/App.php new file mode 100644 index 0000000000..fb030b0955 --- /dev/null +++ b/src/Resource/App.php @@ -0,0 +1,173 @@ +id; + } + + /** + * @return string + */ + public function slug(): string + { + return $this->slug; + } + + /** + * @return User + */ + public function owner(): User + { + return $this->owner; + } + + /** + * @return string + */ + public function name(): string + { + return $this->name; + } + + /** + * @return string + */ + public function description(): string + { + return $this->description; + } + + /** + * @return string + */ + public function externalUrl(): string + { + return $this->external_url; + } + + /** + * @return string + */ + public function htmlUrl(): string + { + return $this->html_url; + } + + /** + * @return DateTimeInterface + */ + public function createdAt(): DateTimeInterface + { + return $this->created_at; + } + + /** + * @return DateTimeInterface + */ + public function updatedAt(): DateTimeInterface + { + return $this->updated_at; + } + + /** + * @return array + */ + public function permissions(): array + { + return $this->permissions; + } + + /** + * @return array + */ + public function events(): array + { + return $this->events; + } + + /** + * @return int + */ + public function installationsCount(): int + { + return $this->installations_count; + } +} diff --git a/src/Resource/AppInterface.php b/src/Resource/AppInterface.php new file mode 100644 index 0000000000..6569510b1f --- /dev/null +++ b/src/Resource/AppInterface.php @@ -0,0 +1,71 @@ +wait($this->handleCommand(new BuildAsyncFromSyncCommand(self::HYDRATE_CLASS, $this))->then(function (AppInterface $app) { + return $app->refresh(); + })); + } +} diff --git a/src/Resource/Sync/EmptyApp.php b/src/Resource/Sync/EmptyApp.php new file mode 100644 index 0000000000..1dedc492b5 --- /dev/null +++ b/src/Resource/Sync/EmptyApp.php @@ -0,0 +1,9 @@ +