]> git.mxchange.org Git - friendica.git/blobdiff - src/Capabilities/ICanHandleRequests.php
Merge pull request #11288 from annando/api-fix2
[friendica.git] / src / Capabilities / ICanHandleRequests.php
index 0e1582bf64080e582fffaae52311a5492c05b5ce..154eae69e5b65ae534fa3057bdf09b4839a8efcf 100644 (file)
@@ -1,79 +1,40 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2022, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Capabilities;
 
+use Friendica\Network\HTTPException;
+use Psr\Http\Message\ResponseInterface;
+
 /**
  * This interface provides the capability to handle requests from clients and returns the desired outcome
  */
 interface ICanHandleRequests
 {
        /**
-        * Initialization method common to both content() and post()
+        * @param array $request The $_REQUEST content (including content from the PHP input stream)
         *
-        * Extend this method if you need to do any shared processing before both
-        * content() or post()
-        */
-       public static function init(array $parameters = []);
-
-       /**
-        * Module GET method to display raw content from technical endpoints
+        * @return ResponseInterface responding to the request handling
         *
-        * Extend this method if the module is supposed to return communication data,
-        * e.g. from protocol implementations.
+        * @throws HTTPException\InternalServerErrorException
         */
-       public static function rawContent(array $parameters = []);
-
-       /**
-        * Module GET method to display any content
-        *
-        * Extend this method if the module is supposed to return any display
-        * through a GET request. It can be an HTML page through templating or a
-        * XML feed or a JSON output.
-        *
-        * @return string
-        */
-       public static function content(array $parameters = []);
-
-       /**
-        * Module DELETE method to process submitted data
-        *
-        * Extend this method if the module is supposed to process DELETE requests.
-        * Doesn't display any content
-        */
-       public static function delete(array $parameters = []);
-
-       /**
-        * Module PATCH method to process submitted data
-        *
-        * Extend this method if the module is supposed to process PATCH requests.
-        * Doesn't display any content
-        */
-       public static function patch(array $parameters = []);
-
-       /**
-        * Module POST method to process submitted data
-        *
-        * Extend this method if the module is supposed to process POST requests.
-        * Doesn't display any content
-        */
-       public static function post(array $parameters = []);
-
-       /**
-        * Called after post()
-        *
-        * Unknown purpose
-        */
-       public static function afterpost(array $parameters = []);
-
-       /**
-        * Module PUT method to process submitted data
-        *
-        * Extend this method if the module is supposed to process PUT requests.
-        * Doesn't display any content
-        */
-       public static function put(array $parameters = []);
-
-       public static function getClassName(): string;
-
-       public static function getParameters(): array;
+       public function run(array $request = []): ResponseInterface;
 }