@@ -21,6 +21,50 @@ public function branch($project_id, $branch_id)
2121 return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_id )));
2222 }
2323
24+ /**
25+ * @param int $project_id
26+ * @param string $branch_name
27+ * @param string $ref
28+ * @return mixed
29+ */
30+ public function createBranch ($ project_id , $ branch_name , $ ref )
31+ {
32+ return $ this ->post ($ this ->getProjectPath ($ project_id , 'repository/branches ' ), array (
33+ 'branch_name ' => $ branch_name ,
34+ 'ref ' => $ ref
35+ ));
36+ }
37+
38+ /**
39+ * @param int $project_id
40+ * @param string $branch_name
41+ * @return mixed
42+ */
43+ public function deleteBranch ($ project_id , $ branch_name )
44+ {
45+ return $ this ->delete ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_name )));
46+ }
47+
48+ /**
49+ * @param int $project_id
50+ * @param string $branch_name
51+ * @return mixed
52+ */
53+ public function protectBranch ($ project_id , $ branch_name )
54+ {
55+ return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_name ).'/protect ' ));
56+ }
57+
58+ /**
59+ * @param int $project_id
60+ * @param string $branch_name
61+ * @return mixed
62+ */
63+ public function unprotectBranch ($ project_id , $ branch_name )
64+ {
65+ return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_name ).'/unprotect ' ));
66+ }
67+
2468 /**
2569 * @param int $project_id
2670 * @return mixed
@@ -30,6 +74,22 @@ public function tags($project_id)
3074 return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/tags ' ));
3175 }
3276
77+ /**
78+ * @param int $project_id
79+ * @param string $name
80+ * @param string $ref
81+ * @param string $message
82+ * @return mixed
83+ */
84+ public function createTag ($ project_id , $ name , $ ref , $ message = null )
85+ {
86+ return $ this ->post ($ this ->getProjectPath ($ project_id , 'repository/tags ' ), array (
87+ 'tag_name ' => $ name ,
88+ 'ref ' => $ ref ,
89+ 'message ' => $ message
90+ ));
91+ }
92+
3393 /**
3494 * @param int $project_id
3595 * @param int $page
@@ -116,51 +176,7 @@ public function diff($project_id, $sha)
116176 */
117177 public function tree ($ project_id , array $ params = array ())
118178 {
119- return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/tree ' , $ params ));
120- }
121-
122- /**
123- * @param int $project_id
124- * @param string $branch_name
125- * @param string $ref
126- * @return mixed
127- */
128- public function createBranch ($ project_id , $ branch_name , $ ref )
129- {
130- return $ this ->post ($ this ->getProjectPath ($ project_id , 'repository/branches ' ), array (
131- 'branch_name ' => $ branch_name ,
132- 'ref ' => $ ref
133- ));
134- }
135-
136- /**
137- * @param int $project_id
138- * @param string $branch_name
139- * @return mixed
140- */
141- public function deleteBranch ($ project_id , $ branch_name )
142- {
143- return $ this ->delete ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_name )));
144- }
145-
146- /**
147- * @param int $project_id
148- * @param string $branch_name
149- * @return mixed
150- */
151- public function protectBranch ($ project_id , $ branch_name )
152- {
153- return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_name ).'/protect ' ));
154- }
155-
156- /**
157- * @param int $project_id
158- * @param string $branch_name
159- * @return mixed
160- */
161- public function unprotectBranch ($ project_id , $ branch_name )
162- {
163- return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_name ).'/unprotect ' ));
179+ return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/tree ' ), $ params );
164180 }
165181
166182 /**
@@ -196,15 +212,17 @@ public function getFile($project_id, $file_path, $ref)
196212 * @param string $content
197213 * @param string $branch_name
198214 * @param string $commit_message
215+ * @param string $encoding
199216 * @return mixed
200217 */
201- public function createFile ($ project_id , $ file_path , $ content , $ branch_name , $ commit_message )
218+ public function createFile ($ project_id , $ file_path , $ content , $ branch_name , $ commit_message, $ encoding = null )
202219 {
203220 return $ this ->post ($ this ->getProjectPath ($ project_id , 'repository/files ' ), array (
204221 'file_path ' => $ file_path ,
205222 'branch_name ' => $ branch_name ,
206223 'content ' => $ content ,
207- 'commit_message ' => $ commit_message
224+ 'commit_message ' => $ commit_message ,
225+ 'encoding ' => $ encoding
208226 ));
209227 }
210228
@@ -214,15 +232,17 @@ public function createFile($project_id, $file_path, $content, $branch_name, $com
214232 * @param string $content
215233 * @param string $branch_name
216234 * @param string $commit_message
235+ * @param string $encoding
217236 * @return mixed
218237 */
219- public function updateFile ($ project_id , $ file_path , $ content , $ branch_name , $ commit_message )
238+ public function updateFile ($ project_id , $ file_path , $ content , $ branch_name , $ commit_message, $ encoding = null )
220239 {
221240 return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/files ' ), array (
222241 'file_path ' => $ file_path ,
223242 'branch_name ' => $ branch_name ,
224243 'content ' => $ content ,
225- 'commit_message ' => $ commit_message
244+ 'commit_message ' => $ commit_message ,
245+ 'encoding ' => $ encoding
226246 ));
227247 }
228248
0 commit comments