New function to handle "get" requests

This commit is contained in:
Michael 2025-01-06 22:04:45 +00:00
parent c2eae676bf
commit 8e76d13a96
9 changed files with 25 additions and 9 deletions

View file

@ -164,6 +164,19 @@ abstract class BaseModule implements ICanHandleRequests
{
}
/**
* Module GET method to process submitted data
*
* Extend this method if the module is supposed to process GET requests.
* Doesn't display any content
*
* @param string[] $request The $_REQUEST content
* @return void
*/
protected function get(array $request = [])
{
}
/**
* {@inheritDoc}
*/
@ -221,7 +234,10 @@ abstract class BaseModule implements ICanHandleRequests
case Router::PUT:
$this->put($request);
return $this->response->generate();
}
case Router::GET:
$this->get($request);
break;
}
$timestamp = microtime(true);
// "rawContent" is especially meant for technical endpoints.

View file

@ -99,7 +99,7 @@ class Lists extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
protected function rawContent(array $request = [])
protected function get(array $request = [])
{
$this->checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -53,7 +53,7 @@ class Accounts extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
protected function rawContent(array $request = [])
protected function get(array $request = [])
{
$this->checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -51,7 +51,7 @@ class Markers extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
protected function rawContent(array $request = [])
protected function get(array $request = [])
{
$this->checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -116,7 +116,7 @@ class Media extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
protected function rawContent(array $request = [])
protected function get(array $request = [])
{
$this->checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -133,7 +133,7 @@ class PushSubscription extends BaseApi
$this->response->addJsonContent([]);
}
protected function rawContent(array $request = []): void
protected function get(array $request = []): void
{
$this->checkAllowedScope(self::SCOPE_PUSH);
$uid = self::getCurrentUserID();

View file

@ -48,7 +48,7 @@ class ScheduledStatuses extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
protected function rawContent(array $request = [])
protected function get(array $request = [])
{
$this->checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();

View file

@ -350,7 +350,7 @@ class Statuses extends BaseApi
/**
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
protected function rawContent(array $request = [])
protected function get(array $request = [])
{
$uid = self::getCurrentUserID();

View file

@ -18,7 +18,7 @@ use Friendica\Module\BaseApi;
*/
class Inbox extends DirectMessagesEndpoint
{
protected function rawContent(array $request = [])
protected function get(array $request = [])
{
$this->checkAllowedScope(BaseApi::SCOPE_READ);
$uid = BaseApi::getCurrentUserID();