Skip to content

Commit e29bdda

Browse files
committed
Replace all calls of AbstractApi::delete() with HttpClient
1 parent 2409bb7 commit e29bdda

File tree

11 files changed

+76
-15
lines changed

11 files changed

+76
-15
lines changed

src/Redmine/Api/Attachment.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ public function upload($attachment, $params = [])
102102
*/
103103
public function remove($id)
104104
{
105-
return $this->delete('/attachments/' . urlencode(strval($id)) . '.xml');
105+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
106+
'DELETE',
107+
'/attachments/' . urlencode(strval($id)) . '.xml'
108+
));
109+
110+
return $this->lastResponse->getContent();
106111
}
107112
}

src/Redmine/Api/Group.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,12 @@ public function show($id, array $params = [])
207207
*/
208208
public function remove($id)
209209
{
210-
return $this->delete('/groups/' . $id . '.xml');
210+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
211+
'DELETE',
212+
'/groups/' . $id . '.xml'
213+
));
214+
215+
return $this->lastResponse->getContent();
211216
}
212217

213218
/**
@@ -249,6 +254,11 @@ public function addUser($id, $userId)
249254
*/
250255
public function removeUser($id, $userId)
251256
{
252-
return $this->delete('/groups/' . $id . '/users/' . $userId . '.xml');
257+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
258+
'DELETE',
259+
'/groups/' . $id . '/users/' . $userId . '.xml'
260+
));
261+
262+
return $this->lastResponse->getContent();
253263
}
254264
}

src/Redmine/Api/Issue.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,12 @@ public function addWatcher($id, $watcherUserId)
300300
*/
301301
public function removeWatcher($id, $watcherUserId)
302302
{
303-
return $this->delete('/issues/' . urlencode(strval($id)) . '/watchers/' . urlencode(strval($watcherUserId)) . '.xml');
303+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
304+
'DELETE',
305+
'/issues/' . urlencode(strval($id)) . '/watchers/' . urlencode(strval($watcherUserId)) . '.xml'
306+
));
307+
308+
return $this->lastResponse->getContent();
304309
}
305310

306311
/**
@@ -438,7 +443,12 @@ public function attachMany($id, array $attachments)
438443
*/
439444
public function remove($id)
440445
{
441-
return $this->delete('/issues/' . urlencode(strval($id)) . '.xml');
446+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
447+
'DELETE',
448+
'/issues/' . urlencode(strval($id)) . '.xml'
449+
));
450+
451+
return $this->lastResponse->getContent();
442452
}
443453

444454
/**

src/Redmine/Api/IssueCategory.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,11 @@ public function update($id, array $params)
234234
*/
235235
public function remove($id, array $params = [])
236236
{
237-
return $this->delete(
237+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
238+
'DELETE',
238239
PathSerializer::create('/issue_categories/' . urlencode(strval($id)) . '.xml', $params)->getPath()
239-
);
240+
));
241+
242+
return $this->lastResponse->getContent();
240243
}
241244
}

src/Redmine/Api/IssueRelation.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ public function show($id)
122122
*/
123123
public function remove($id)
124124
{
125-
return $this->delete('/relations/' . $id . '.xml');
125+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
126+
'DELETE',
127+
'/relations/' . $id . '.xml'
128+
));
129+
130+
return $this->lastResponse->getContent();
126131
}
127132

128133
/**

src/Redmine/Api/Membership.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ public function update($id, array $params = [])
167167
*/
168168
public function remove($id)
169169
{
170-
return $this->delete('/memberships/' . $id . '.xml');
170+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
171+
'DELETE',
172+
'/memberships/' . $id . '.xml'
173+
));
174+
175+
return $this->lastResponse->getContent();
171176
}
172177

173178
/**

src/Redmine/Api/Project.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ protected function prepareParamsXml($params)
396396
*/
397397
public function remove($id)
398398
{
399-
return $this->delete('/projects/' . $id . '.xml');
399+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
400+
'DELETE',
401+
'/projects/' . $id . '.xml'
402+
));
403+
404+
return $this->lastResponse->getContent();
400405
}
401406
}

src/Redmine/Api/TimeEntry.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ public function update($id, array $params)
191191
*/
192192
public function remove($id)
193193
{
194-
return $this->delete('/time_entries/' . $id . '.xml');
194+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
195+
'DELETE',
196+
'/time_entries/' . $id . '.xml'
197+
));
198+
199+
return $this->lastResponse->getContent();
195200
}
196201
}

src/Redmine/Api/User.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ public function update($id, array $params)
267267
*/
268268
public function remove($id)
269269
{
270-
return $this->delete('/users/' . $id . '.xml');
270+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
271+
'DELETE',
272+
'/users/' . $id . '.xml'
273+
));
274+
275+
return $this->lastResponse->getContent();
271276
}
272277
}

src/Redmine/Api/Version.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ private function validateSharing(array $params = [])
270270
*/
271271
public function remove($id)
272272
{
273-
return $this->delete('/versions/' . $id . '.xml');
273+
$this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeXmlRequest(
274+
'DELETE',
275+
'/versions/' . $id . '.xml'
276+
));
277+
278+
return $this->lastResponse->getContent();
274279
}
275280
}

0 commit comments

Comments
 (0)