]> git.mxchange.org Git - friendica.git/blobdiff - src/Capabilities/ICanCreateResponses.php
Replace IRespondToRequests with PSR-7 ResponseInterface
[friendica.git] / src / Capabilities / ICanCreateResponses.php
index 282458136bb58aae726a4fd71e5f4ebf94631d7b..21a7b1bde925022202af533d8aa2862d7a119afe 100644 (file)
@@ -3,9 +3,24 @@
 namespace Friendica\Capabilities;
 
 use Friendica\Network\HTTPException\InternalServerErrorException;
+use Psr\Http\Message\ResponseInterface;
 
-interface ICanCreateResponses extends IRespondToRequests
+interface ICanCreateResponses
 {
+       const TYPE_HTML = 'html';
+       const TYPE_XML  = 'xml';
+       const TYPE_JSON = 'json';
+       const TYPE_ATOM = 'atom';
+       const TYPE_RSS  = 'rss';
+
+       const ALLOWED_TYPES = [
+               self::TYPE_HTML,
+               self::TYPE_XML,
+               self::TYPE_JSON,
+               self::TYPE_ATOM,
+               self::TYPE_RSS
+       ];
+
        /**
         * Adds a header entry to the module response
         *
@@ -30,4 +45,12 @@ interface ICanCreateResponses extends IRespondToRequests
         * @throws InternalServerErrorException
         */
        public function setType(string $type, ?string $content_type = null): void;
+
+       /**
+        * Creates a PSR-7 compliant interface
+        * @see https://www.php-fig.org/psr/psr-7/
+        *
+        * @return ResponseInterface
+        */
+       public function generate(): ResponseInterface;
 }