+ /**
+ * Check if the pharext webhook is set and return it
+ * @param array $hooks
+ * @return stdClass hook
+ */
+ function checkHook($hooks) {
+ if (!empty($hooks)) {
+ foreach ($hooks as $hook) {
+ if ($hook->name === "web" && $hook->config->url === $this->config->hook->url) {
+ return $hook;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Check if the pharext webhook is set for the repo and return it
+ * @param object $repo
+ * @return stdClass hook
+ */
+ function checkRepoHook($repo) {
+ if (!empty($repo->hooks)) {
+ return $this->checkHook($repo->hooks);
+ }
+ return null;
+ }
+
+ function listHooks($repo) {
+ return $this->queue(new API\Hooks\ListHooks($this, compact("repo")));
+ }
+
+ function listReleases($repo, $page) {
+ return $this->queue(new API\Releases\ListReleases($this, compact("repo", "page")));
+ }
+
+ function listTags($repo, $page) {
+ return $this->queue(new API\Tags\ListTags($this, compact("repo", "page")));
+ }
+
+ function readContents($repo, $path = null) {
+ return $this->queue(new API\Repos\ReadContents($this, compact("repo", "path")));
+ }
+
+ function createRepoHook($repo, $conf) {
+ return $this->queue(new API\Hooks\CreateHook($this, compact("repo", "conf")));
+ }
+
+ function updateRepoHook($repo, $id, $conf) {
+ return $this->queue(new API\Hooks\UpdateHook($this, compact("repo", "id", "conf")));
+ }
+
+ function deleteRepoHook($repo, $id) {
+ return $this->queue(new API\Hooks\DeleteHook($this, compact("repo", "id")));
+ }
+
+ function createRelease($repo, $tag) {
+ return $this->queue(new API\Releases\CreateRelease($this, compact("repo", "tag")));