Skip to content

Commit b1d94c9

Browse files
authored
Merge branch 'master' into v4-api-9337
2 parents 9b39f0a + cd1014b commit b1d94c9

File tree

5 files changed

+54
-45
lines changed

5 files changed

+54
-45
lines changed

UPGRADE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,25 @@ See [documentation](doc/customize.md) to know how to customize the client timeou
1313
* The `setHttpClient` method have been removed. Use a `Gitlab\HttpClient\Builder` instead.
1414
* The `getHttpClient` method return type is changed to `Http\Client\Common\HttpMethodsClient`.
1515

16+
1617
## `Gitlab\Api\Groups` changes
1718

1819
* The `visibility_level` parameter have been removed from `create` method. Use `visibility` instead.
1920

21+
## `Gitlab\Api\Issues` changes
22+
23+
* The second argument of `update`, `remove`, `showComments`, `showComment`, `addComment`, `updateComment`, `removeComment`,
24+
`setTimeEstimate`, `resetTimeEstimate`, `addSpentTime` and `resetSpentTime` methods is now a scoped issue id (iid).
25+
2026
## `Gitlab\Api\Projects` changes
2127

2228
* The `keys`, `key`, `addKey`, `removeKey`, `disableKey` and `enableKey` methods have been removed.
2329
Use the `deployKeys`, `deployKey`, `addDeployKey`, `deleteDeployKey`, `removeDeployKey` and `enableDeployKey` instead.
2430

31+
## `Gitlab\Api\Repositories` changes
32+
33+
* The `commits` page argument now start from 1 instead of 0.
34+
2535
## `Gitlab\Model\Project` changes
2636

2737
* The `keys`, `key`, `addKey`, `removeKey`, `disableKey` and `enableKey` methods have been removed.

lib/Gitlab/Api/Issues.php

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, a
2424

2525
/**
2626
* @param int $project_id
27-
* @param int $issue_id
27+
* @param int $issue_iid
2828
* @return mixed
2929
*/
30-
public function show($project_id, $issue_id)
30+
public function show($project_id, $issue_iid)
3131
{
32-
return $this->get($this->getProjectPath($project_id, 'issues?iid='.$this->encodePath($issue_id)));
32+
return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)));
3333
}
3434

3535
/**
@@ -44,53 +44,53 @@ public function create($project_id, array $params)
4444

4545
/**
4646
* @param int $project_id
47-
* @param int $issue_id
47+
* @param int $issue_iid
4848
* @param array $params
4949
* @return mixed
5050
*/
51-
public function update($project_id, $issue_id, array $params)
51+
public function update($project_id, $issue_iid, array $params)
5252
{
53-
return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)), $params);
53+
return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)), $params);
5454
}
5555

5656
/**
5757
* @param int $project_id
58-
* @param int $issue_id
58+
* @param int $issue_iid
5959
* @return mixed
6060
*/
61-
public function remove($project_id, $issue_id)
61+
public function remove($project_id, $issue_iid)
6262
{
63-
return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)));
63+
return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)));
6464
}
6565

6666
/**
6767
* @param int $project_id
68-
* @param int $issue_id
68+
* @param int $issue_iid
6969
* @return mixed
7070
*/
71-
public function showComments($project_id, $issue_id)
71+
public function showComments($project_id, $issue_iid)
7272
{
73-
return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes');
73+
return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/notes');
7474
}
7575

7676
/**
7777
* @param int $project_id
78-
* @param int $issue_id
78+
* @param int $issue_iid
7979
* @param int $note_id
8080
* @return mixed
8181
*/
82-
public function showComment($project_id, $issue_id, $note_id)
82+
public function showComment($project_id, $issue_iid, $note_id)
8383
{
84-
return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes/'.$this->encodePath($note_id));
84+
return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/notes/'.$this->encodePath($note_id));
8585
}
8686

8787
/**
8888
* @param int $project_id
89-
* @param int $issue_id
89+
* @param int $issue_iid
9090
* @param string|array $body
9191
* @return mixed
9292
*/
93-
public function addComment($project_id, $issue_id, $body)
93+
public function addComment($project_id, $issue_iid, $body)
9494
{
9595
// backwards compatibility
9696
if (is_array($body)) {
@@ -99,70 +99,70 @@ public function addComment($project_id, $issue_id, $body)
9999
$params = array('body' => $body);
100100
}
101101

102-
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes'), $params);
102+
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes'), $params);
103103
}
104104

105105
/**
106106
* @param int $project_id
107-
* @param int $issue_id
107+
* @param int $issue_iid
108108
* @param int $note_id
109109
* @param string $body
110110
* @return mixed
111111
*/
112-
public function updateComment($project_id, $issue_id, $note_id, $body)
112+
public function updateComment($project_id, $issue_iid, $note_id, $body)
113113
{
114-
return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes/'.$this->encodePath($note_id)), array(
114+
return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes/'.$this->encodePath($note_id)), array(
115115
'body' => $body
116116
));
117117
}
118118

119119
/**
120120
* @param int $project_id
121-
* @param int $issue_id
121+
* @param int $issue_iid
122122
* @param int $note_id
123123
* @return mixed
124124
*/
125-
public function removeComment($project_id, $issue_id, $note_id)
125+
public function removeComment($project_id, $issue_iid, $note_id)
126126
{
127-
return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes/'.$this->encodePath($note_id)));
127+
return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes/'.$this->encodePath($note_id)));
128128
}
129129

130130
/**
131131
* @param int $project_id
132-
* @param int $issue_id
132+
* @param int $issue_iid
133133
* @param string $duration
134134
*/
135-
public function setTimeEstimate($project_id, $issue_id, $duration)
135+
public function setTimeEstimate($project_id, $issue_iid, $duration)
136136
{
137-
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/time_estimate'), array('duration' => $duration));
137+
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/time_estimate'), array('duration' => $duration));
138138
}
139139

140140
/**
141141
* @param int $project_id
142-
* @param int $issue_id
142+
* @param int $issue_iid
143143
*/
144-
public function resetTimeEstimate($project_id, $issue_id)
144+
public function resetTimeEstimate($project_id, $issue_iid)
145145
{
146-
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/reset_time_estimate'));
146+
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/reset_time_estimate'));
147147
}
148148

149149
/**
150150
* @param int $project_id
151-
* @param int $issue_id
151+
* @param int $issue_iid
152152
* @param string $duration
153153
*/
154-
public function addSpentTime($project_id, $issue_id, $duration)
154+
public function addSpentTime($project_id, $issue_iid, $duration)
155155
{
156-
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/add_spent_time'), array('duration' => $duration));
156+
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/add_spent_time'), array('duration' => $duration));
157157
}
158158

159159
/**
160160
* @param int $project_id
161-
* @param int $issue_id
161+
* @param int $issue_iid
162162
*/
163-
public function resetSpentTime($project_id, $issue_id)
163+
public function resetSpentTime($project_id, $issue_iid)
164164
{
165-
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/reset_spent_time'));
165+
return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/reset_spent_time'));
166166
}
167167

168168
/**

lib/Gitlab/Api/Repositories.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function commitBuilds($project_id, $sha, $scope = null, $page = 0, $per_p
150150
* @param null $ref_name
151151
* @return mixed
152152
*/
153-
public function commits($project_id, $page = 0, $per_page = self::PER_PAGE, $ref_name = null)
153+
public function commits($project_id, $page = 1, $per_page = self::PER_PAGE, $ref_name = null)
154154
{
155155
return $this->get($this->getProjectPath($project_id, 'repository/commits'), array(
156156
'page' => $page,
@@ -240,8 +240,8 @@ public function tree($project_id, array $params = array())
240240
*/
241241
public function blob($project_id, $sha, $filepath)
242242
{
243-
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/blob'), array(
244-
'filepath' => $filepath
243+
return $this->get($this->getProjectPath($project_id, 'repository/files/'.$this->encodePath($filepath).'/raw'), array(
244+
'ref' => $sha,
245245
));
246246
}
247247

@@ -253,8 +253,7 @@ public function blob($project_id, $sha, $filepath)
253253
*/
254254
public function getFile($project_id, $file_path, $ref)
255255
{
256-
return $this->get($this->getProjectPath($project_id, 'repository/files'), array(
257-
'file_path' => $file_path,
256+
return $this->get($this->getProjectPath($project_id, 'repository/files/'.$this->encodePath($file_path)), array(
258257
'ref' => $ref
259258
));
260259
}

test/Gitlab/Tests/Api/IssuesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function shouldShowIssue()
7474
$api = $this->getApiMock();
7575
$api->expects($this->once())
7676
->method('get')
77-
->with('projects/1/issues?iid=2')
77+
->with('projects/1/issues/2')
7878
->will($this->returnValue($expectedArray))
7979
;
8080

test/Gitlab/Tests/Api/RepositoriesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function shouldGetCommits()
228228
$api = $this->getApiMock();
229229
$api->expects($this->once())
230230
->method('get')
231-
->with('projects/1/repository/commits', array('page' => 0, 'per_page' => AbstractApi::PER_PAGE, 'ref_name' => null))
231+
->with('projects/1/repository/commits', array('page' => 1, 'per_page' => AbstractApi::PER_PAGE, 'ref_name' => null))
232232
->will($this->returnValue($expectedArray))
233233
;
234234

@@ -461,7 +461,7 @@ public function shouldGetBlob()
461461
$api = $this->getApiMock();
462462
$api->expects($this->once())
463463
->method('get')
464-
->with('projects/1/repository/commits/abcd1234/blob', array('filepath' => 'dir/file1.txt'))
464+
->with('projects/1/repository/files/dir%2Ffile1%2Etxt/raw', array('ref' => 'abcd1234'))
465465
->will($this->returnValue($expectedString))
466466
;
467467

@@ -478,7 +478,7 @@ public function shouldGetFile()
478478
$api = $this->getApiMock();
479479
$api->expects($this->once())
480480
->method('get')
481-
->with('projects/1/repository/files', array('file_path' => 'dir/file1.txt', 'ref' => 'abcd1234'))
481+
->with('projects/1/repository/files/dir%2Ffile1%2Etxt', array('ref' => 'abcd1234'))
482482
->will($this->returnValue($expectedArray))
483483
;
484484

0 commit comments

Comments
 (0)