Skip to content

Commit 820eabe

Browse files
author
Matt Humphrey
committed
Added forkTo and forkFrom methods
1 parent 95963bc commit 820eabe

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lib/Gitlab/Api/Projects.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,14 @@ public function search($query)
148148
return $this->get('projects/search/'.urlencode($query));
149149
}
150150

151+
public function createForkRelation($project_id, $forked_project_id)
152+
{
153+
return $this->post('projects/'.urlencode($project_id).'/fork/'.urlencode($forked_project_id));
154+
}
155+
156+
public function removeForkRelation($project_id)
157+
{
158+
return $this->delete('projects/'.urlencode($project_id).'/fork');
159+
}
160+
151161
}

lib/Gitlab/Model/Project.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,4 +496,24 @@ public function transfer($group_id)
496496

497497
return $group->transfer($this->id);
498498
}
499+
500+
public function forkTo($id)
501+
{
502+
return $this->api('projects')->createForkRelation($id, $this->id);
503+
}
504+
505+
public function forkFrom($id)
506+
{
507+
return $this->createForkRelation($id);
508+
}
509+
510+
public function createForkRelation($id)
511+
{
512+
return $this->api('projects')->createForkRelation($this->id, $id);
513+
}
514+
515+
public function removeForkRelation()
516+
{
517+
return $this->api('projects')->removeForkRelation($this->id);
518+
}
499519
}

0 commit comments

Comments
 (0)