|
@@ -217,6 +217,99 @@ namespace Gogs\API\Request {
|
|
|
$repo->json_set_property($obj);
|
|
|
return $this->add($repo, $repo->full_name);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * Get private repositories
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function privates() {
|
|
|
+ return $this->filter(function(Repo $r) {
|
|
|
+ return $r->private;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Get public repositories
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function publics() {
|
|
|
+ return $this->filter(function(Repo $r) {
|
|
|
+ return !$r->private;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Get personal repositories
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function personals() {
|
|
|
+ if (empty($this->owner))
|
|
|
+ return new \Gogs\Lib\Collection();
|
|
|
+
|
|
|
+ return $this->filter(function(Repo $r) {
|
|
|
+ return $this->owner->username == $r->owner->username;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Get repositories contributed to
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function contributions() {
|
|
|
+ if (empty($this->owner))
|
|
|
+ return new \Gogs\Lib\Collection();
|
|
|
+
|
|
|
+ return $this->filter(function(Repo $r) {
|
|
|
+ return $this->owner->username != $r->owner->username;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Get personal private repositories
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function personals_privates() {
|
|
|
+ return $this->personals()->filter(function(Repo $r) {
|
|
|
+ return $r->private;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Get personal public repositories
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function personals_publics() {
|
|
|
+ return $this->personals()->filter(function(Repo $r) {
|
|
|
+ return !$r->private;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Get private contributions
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function contributions_privates() {
|
|
|
+ return $this->contributions()->filter(function(Repo $r) {
|
|
|
+ return $r->private;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ * Get public contributions
|
|
|
+ *
|
|
|
+ * @return \Gogs\Lib\Collection
|
|
|
+ */
|
|
|
+ public function contributions_publics() {
|
|
|
+ return $this->contributions()->filter(function(Repo $r) {
|
|
|
+ return !$r->private;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|