3 namespace Friendica\Capabilities;
5 use Friendica\Network\HTTPException\InternalServerErrorException;
6 use Psr\Http\Message\ResponseInterface;
8 interface ICanCreateResponses
11 * This constant helps to find the specific return type of responses inside the headers array
13 const X_HEADER = 'X-RESPONSE-TYPE';
15 const TYPE_HTML = 'html';
16 const TYPE_XML = 'xml';
17 const TYPE_JSON = 'json';
18 const TYPE_ATOM = 'atom';
19 const TYPE_RSS = 'rss';
21 const ALLOWED_TYPES = [
30 * Adds a header entry to the module response
32 * @param string $header
33 * @param string|null $key
35 public function setHeader(string $header, ?string $key = null): void;
38 * Adds output content to the module response
40 * @param mixed $content
42 public function addContent($content): void;
45 * Sets the response type of the current request
48 * @param string|null $content_type (optional) overrides the direct content_type, otherwise set the default one
50 * @throws InternalServerErrorException
52 public function setType(string $type, ?string $content_type = null): void;
55 * Creates a PSR-7 compliant interface
56 * @see https://www.php-fig.org/psr/psr-7/
58 * @return ResponseInterface
60 public function generate(): ResponseInterface;