use function FastRoute\simpleDispatcher;
+/**
+ * Resolves and forwards API requests to the responsible controllers, exposing
+ * a unified JSON-based response with a clearly defined behavior.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
#[AllowHttpMethod('DELETE')]
final class ApiAction implements RequestHandlerInterface
{
namespace wcf\system\endpoint;
+/**
+ * Shortcut attribute for API endpoints using DELETE.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
#[\Attribute(\Attribute::TARGET_CLASS)]
final class DeleteRequest extends RequestType
{
namespace wcf\system\endpoint;
+/**
+ * Shortcut attribute for API endpoints using GET.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
#[\Attribute(\Attribute::TARGET_CLASS)]
final class GetRequest extends RequestType
{
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
+/**
+ * Handles incoming API requests, relying on the `RequestType` attributes to
+ * register the endpoint. The endpoint can contain placeholders for parameters.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
interface IController
{
/**
+ * Invokes the controller, passing in any placeholders from the endpoint in
+ * the `$variables` array.
+ *
* @param array<string, string> $variables
* @throws MappingError
*/
namespace wcf\system\endpoint;
+/**
+ * Shortcut attribute for API endpoints using POST.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
#[\Attribute(\Attribute::TARGET_CLASS)]
final class PostRequest extends RequestType
{
namespace wcf\system\endpoint;
+/**
+ * Represents different classes of errors for API endpoints.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
enum RequestFailure
{
case InternalError;
namespace wcf\system\endpoint;
+/**
+ * Represents the supported HTTP verbs for API endpoints.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
enum RequestMethod
{
case DELETE;
namespace wcf\system\endpoint;
+/**
+ * Defines the HTTP verb and route of an API endpoint.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
#[\Attribute(\Attribute::TARGET_CLASS)]
class RequestType
{
use wcf\http\Helper;
use wcf\system\endpoint\GetRequest;
use wcf\system\endpoint\IController;
+use wcf\system\exception\UserInputException;
use wcf\system\WCF;
+/**
+ * Retrieves the list of users and groups that can be mentioned.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
#[GetRequest('/core/messages/mentionsuggestions')]
final class MentionSuggestions implements IController
{
use wcf\system\session\SessionHandler;
use wcf\system\WCF;
+/**
+ * Deletes one of the current user’s sessions, causing a device with that
+ * session id to be logged out.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
#[DeleteRequest('/core/sessions/{id}')]
final class DeleteSession implements IController
{
use wcf\system\endpoint\IController;
use wcf\system\event\IEvent;
+/**
+ * Collects the list of API controllers.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2024 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since 6.1
+ */
final class ControllerCollecting implements IEvent
{
/**