Replace DI::apiResponse()->exit() with $this->response->exit()

This commit is contained in:
Philipp Holzer 2021-11-28 15:05:42 +01:00 committed by Hypolite Petovan
parent 2dc60cfd33
commit a88cc8d5c8
22 changed files with 26 additions and 26 deletions

View file

@ -22,7 +22,6 @@
namespace Friendica\Module\Api\Friendica\Group;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Module\BaseApi;
@ -84,6 +83,6 @@ class Update extends BaseApi
// return success message incl. missing users in array
$status = ($erroraddinguser ? 'missing user' : 'ok');
$success = ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers];
DI::apiResponse()->exit('group_update', ['$result' => $success], $this->parameters['extension'] ?? null);
$this->response->exit('group_update', ['$result' => $success], $this->parameters['extension'] ?? null);
}
}

View file

@ -70,12 +70,12 @@ class Seen extends BaseApi
// we found the item, return it to the user
$ret = [DI::twitterStatus()->createFromUriId($item['uri-id'], $item['uid'], $include_entities)->toArray()];
$data = ['status' => $ret];
DI::apiResponse()->exit('statuses', $data, $this->parameters['extension'] ?? null);
$this->response->exit('statuses', $data, $this->parameters['extension'] ?? null);
}
// the item can't be found, but we set the notification as seen, so we count this as a success
}
DI::apiResponse()->exit('statuses', ['result' => 'success'], $this->parameters['extension'] ?? null);
$this->response->exit('statuses', ['result' => 'success'], $this->parameters['extension'] ?? null);
} catch (NotFoundException $e) {
throw new BadRequestException('Invalid argument', $e);
} catch (Exception $e) {

View file

@ -90,6 +90,6 @@ class Conversation extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -64,6 +64,6 @@ class UpdateProfile extends BaseApi
// "uid" is only needed for some internal stuff, so remove it from here
unset($user_info['uid']);
DI::apiResponse()->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
$this->response->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
}
}

View file

@ -47,6 +47,6 @@ class VerifyCredentials extends BaseApi
// "uid" is only needed for some internal stuff, so remove it from here
unset($user_info['uid']);
DI::apiResponse()->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
$this->response->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
}
}

View file

@ -72,6 +72,6 @@ class Favorites extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -46,6 +46,6 @@ class Create extends BaseApi
$status_info = DI::twitterStatus()->createFromItemId($id, $uid)->toArray();
DI::apiResponse()->exit('status', ['status' => $status_info], $this->parameters['extension'] ?? null);
$this->response->exit('status', ['status' => $status_info], $this->parameters['extension'] ?? null);
}
}

View file

@ -46,6 +46,6 @@ class Destroy extends BaseApi
$status_info = DI::twitterStatus()->createFromItemId($id, $uid)->toArray();
DI::apiResponse()->exit('status', ['status' => $status_info], $this->parameters['extension'] ?? null);
$this->response->exit('status', ['status' => $status_info], $this->parameters['extension'] ?? null);
}
}

View file

@ -81,6 +81,6 @@ class Destroy extends ContactEndpoint
throw new HTTPException\InternalServerErrorException('Unable to unfollow this contact, please contact your administrator');
}
DI::apiResponse()->exit('friendships', ['user' => $user], $this->parameters['extension'] ?? null);
$this->response->exit('friendships', ['user' => $user], $this->parameters['extension'] ?? null);
}
}

View file

@ -83,6 +83,6 @@ class Statuses extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('statuses', ['status' => $items], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $items], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -65,6 +65,6 @@ class Upload extends BaseApi
Logger::info('Media uploaded', ['return' => $returndata]);
DI::apiResponse()->exit('media', ['media' => $returndata], $this->parameters['extension'] ?? null);
$this->response->exit('media', ['media' => $returndata], $this->parameters['extension'] ?? null);
}
}

View file

@ -77,7 +77,8 @@ class Tweets extends BaseApi
DBA::close($tags);
if (empty($uriids)) {
DI::apiResponse()->exit('statuses', $data, $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', $data, $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
return;
}
$condition = ['uri-id' => $uriids];
@ -122,6 +123,6 @@ class Tweets extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -53,6 +53,6 @@ class Destroy extends BaseApi
Item::deleteForUser(['id' => $id], $uid);
DI::apiResponse()->exit('status', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('status', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -88,6 +88,6 @@ class HomeTimeline extends BaseApi
}
}
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -80,6 +80,6 @@ class Mentions extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -66,6 +66,6 @@ class NetworkPublicTimeline extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -86,6 +86,6 @@ class PublicTimeline extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -89,10 +89,10 @@ class Show extends BaseApi
if ($conversation) {
$data = ['status' => $ret];
DI::apiResponse()->exit('statuses', $data, $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('statuses', $data, $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
} else {
$data = ['status' => $ret[0]];
DI::apiResponse()->exit('status', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('status', ['status' => $data], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}
}

View file

@ -82,6 +82,6 @@ class UserTimeline extends BaseApi
}
DBA::close($statuses);
DI::apiResponse()->exit('user', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
$this->response->exit('user', ['status' => $ret], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
}
}

View file

@ -51,6 +51,6 @@ class Lookup extends BaseApi
throw new NotFoundException();
}
DI::apiResponse()->exit('users', ['user' => $users], $this->parameters['extension'] ?? null);
$this->response->exit('users', ['user' => $users], $this->parameters['extension'] ?? null);
}
}

View file

@ -69,6 +69,6 @@ class Search extends BaseApi
throw new BadRequestException('No search term specified.');
}
DI::apiResponse()->exit('users', ['user' => $userlist], $this->parameters['extension'] ?? null);
$this->response->exit('users', ['user' => $userlist], $this->parameters['extension'] ?? null);
}
}

View file

@ -48,6 +48,6 @@ class Show extends BaseApi
// "uid" is only needed for some internal stuff, so remove it from here
unset($user_info['uid']);
DI::apiResponse()->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
$this->response->exit('user', ['user' => $user_info], $this->parameters['extension'] ?? null);
}
}