/** * add a webhook * @param string $url the url for the hook * @param Array $events the evnets on which this webhook should be called (all events with ['*']) * @return string|\stdClass|array */ public function addNew($url, array $events) { \GitHub::setRQdata(['name' => 'web', 'config' => ['url' => $url, 'content_type' => 'json', 'secret' => \App::get('GitHub')->secret], 'events' => $events]); $url = \GitHub::$endpoint . "repositories/{$this->repo->id}/hooks"; $k = count($this->webhooks); $this->webhooks[$k] = new \GitHub\WebhookMeta(); $this->webhooks[$k]->setData(\GitHub::post($url)); return $this; }