|
MediaWiki master
|
Helper for action API modules that support the REST paradigm. More...
Inherited by MediaWiki\Api\ApiListRestHelper.
Public Member Functions | |
| __construct (protected readonly ApiRestHelperContext $context, protected readonly ?string $responseBodySchemaFileName=null,) | |
| getResponseBodySchema () | |
| Returns an OpenAPI Schema Object specification structure as an associative array. | |
| getResponseBodySchemaFileName () | |
| Returns the absolute path of a JSON file containing an OpenAPI Schema Object specification structure describing the response body. | |
| getStatusForErrorMessage (IApiMessage $msg) | |
| Returns the HTTP status code that should be returned to the client along with the given message. | |
Helper for action API modules that support the REST paradigm.
This is used as glue by the ActionModuleBasedHandler in the REST framework to help with translating an action API result to a REST response.
Definition at line 15 of file ApiRestHelper.php.
| MediaWiki\Api\ApiRestHelper::__construct | ( | protected readonly ApiRestHelperContext | $context, |
| protected readonly ?string | $responseBodySchemaFileName = null ) |
| ApiRestHelperContext | $context | provides information about the REST route definition. Typically passed through from ApiRestHybrid::initRestMode(). |
| ?string | $responseBodySchemaFileName | File path of a response body schema. May be null if getResponseBodySchemaFileName() or getResponseBodySchema() are overridden. |
Definition at line 26 of file ApiRestHelper.php.
| MediaWiki\Api\ApiRestHelper::getResponseBodySchema | ( | ) |
Returns an OpenAPI Schema Object specification structure as an associative array.
Reimplemented in MediaWiki\Api\ApiListRestHelper.
Definition at line 57 of file ApiRestHelper.php.
References getResponseBodySchemaFileName().
| MediaWiki\Api\ApiRestHelper::getResponseBodySchemaFileName | ( | ) |
Returns the absolute path of a JSON file containing an OpenAPI Schema Object specification structure describing the response body.
Definition at line 70 of file ApiRestHelper.php.
References if.
Referenced by getResponseBodySchema().
| MediaWiki\Api\ApiRestHelper::getStatusForErrorMessage | ( | IApiMessage | $msg | ) |
Returns the HTTP status code that should be returned to the client along with the given message.
If 0 is returned, it is left to ActionModuleBasedHandler to determine the status code. This will generally result in status 400 being returned, except for some well known kinds of errors such as 'badtoken' (401) or 'ratelimited' (429).
Definition at line 41 of file ApiRestHelper.php.
References return.