]> git.mxchange.org Git - friendica.git/commitdiff
New function to handle "get" requests
authorMichael <heluecht@pirati.ca>
Mon, 6 Jan 2025 22:04:45 +0000 (22:04 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 6 Jan 2025 22:04:45 +0000 (22:04 +0000)
src/BaseModule.php
src/Module/Api/Mastodon/Lists.php
src/Module/Api/Mastodon/Lists/Accounts.php
src/Module/Api/Mastodon/Markers.php
src/Module/Api/Mastodon/Media.php
src/Module/Api/Mastodon/PushSubscription.php
src/Module/Api/Mastodon/ScheduledStatuses.php
src/Module/Api/Mastodon/Statuses.php
src/Module/Api/Twitter/DirectMessages/Inbox.php

index a1f4c033c6a4b76b9378a3c2bf48c04292400405..aa72249c7326fc942c60e3fa438630dc51a2570a 100644 (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.
index b2f3292d9e133793c7b9e4893ab3914e89aaf8d1..2fe4e9df7f945487ebfb8f1ff2981b0122bc32e0 100644 (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();
index a220301e7aa617b13242e8ba303917c8b8f84138..5d3798946ca7d7ba636ad526cdb0c5d760199d3d 100644 (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();
index 11ae2e9324733de1a4262a732b9a2be28b055518..5c9b6476a1738ff3f09035569be47acb5345a893 100644 (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();
index cc69d5a54637ca6f372d06664fa6af1807b86b3a..b15f1cc81c314d4fd40dbf2e804e0f108e047bce 100644 (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();
index a83263bb2449812e8bb13517241c6ddd2fc63b36..835a8273d59576b7ba2afdc3c99bf71e63be6727 100644 (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();
index e63d81522d5aac9b989b6926c77fc725f8149bc3..3cb8568639616d09538fb5803637bfcb2edb08eb 100644 (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();
index 2a3da0288a1c2e141fcb181871fb3fe3051dca34..8d0fcdd2099318594efbcfc1f8c0a026c4d5f710 100644 (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();
 
index fbf5ac9096918c825dfd6f1be3ac2fa06bb272cc..fe017b16a653aaa2fa82696eacfea28b46974c26 100644 (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();