@@ -21,6 +21,50 @@ public function branch($project_id, $branch_id)
21
21
return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/branches/ ' .urlencode ($ branch_id )));
22
22
}
23
23
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
+
24
68
/**
25
69
* @param int $project_id
26
70
* @return mixed
@@ -30,6 +74,22 @@ public function tags($project_id)
30
74
return $ this ->get ($ this ->getProjectPath ($ project_id , 'repository/tags ' ));
31
75
}
32
76
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
+
33
93
/**
34
94
* @param int $project_id
35
95
* @param int $page
@@ -116,51 +176,7 @@ public function diff($project_id, $sha)
116
176
*/
117
177
public function tree ($ project_id , array $ params = array ())
118
178
{
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 );
164
180
}
165
181
166
182
/**
@@ -196,15 +212,17 @@ public function getFile($project_id, $file_path, $ref)
196
212
* @param string $content
197
213
* @param string $branch_name
198
214
* @param string $commit_message
215
+ * @param string $encoding
199
216
* @return mixed
200
217
*/
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 )
202
219
{
203
220
return $ this ->post ($ this ->getProjectPath ($ project_id , 'repository/files ' ), array (
204
221
'file_path ' => $ file_path ,
205
222
'branch_name ' => $ branch_name ,
206
223
'content ' => $ content ,
207
- 'commit_message ' => $ commit_message
224
+ 'commit_message ' => $ commit_message ,
225
+ 'encoding ' => $ encoding
208
226
));
209
227
}
210
228
@@ -214,15 +232,17 @@ public function createFile($project_id, $file_path, $content, $branch_name, $com
214
232
* @param string $content
215
233
* @param string $branch_name
216
234
* @param string $commit_message
235
+ * @param string $encoding
217
236
* @return mixed
218
237
*/
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 )
220
239
{
221
240
return $ this ->put ($ this ->getProjectPath ($ project_id , 'repository/files ' ), array (
222
241
'file_path ' => $ file_path ,
223
242
'branch_name ' => $ branch_name ,
224
243
'content ' => $ content ,
225
- 'commit_message ' => $ commit_message
244
+ 'commit_message ' => $ commit_message ,
245
+ 'encoding ' => $ encoding
226
246
));
227
247
}
228
248
0 commit comments