Reply final class
Minn\Rest\Reply · public/minn/src/Minn/Rest/Reply.php · 53 lines
JSON responses in the reference's shape: its header set, its json_encode flags (slashes escaped), the _fields filter, and the pagination headers on lists.
Used by 40 (show)
Admin\BundleControllerAdmin\EditorControllerAdmin\LanguageControllerAdmin\OverviewControllerAdmin\PackagesControllerAdmin\PreferencesControllerAdmin\RenderControllerAdmin\SessionsControllerAdmin\SiteControllerAdmin\StructureControllerAdmin\SystemControllerAdmin\ThemesControllerAdmin\UpdatesControllerAdmin\V1ControllerApiApplicationPasswordsControllerBatchControllerBlockRendererControllerBlockTypesControllerBlocksControllerCommentsControllerEmbedGlobalStylesControllerIndexControllerInstalledThemesControllerMediaControllerMenusControllerPluginsControllerPostsControllerPostsWriteControllerRevisionsControllerRuntimeRoutesSearchControllerSettingsControllerSidebarsControllerStatusesControllerTemplatesControllerTermsControllerUsersControllerWidgetsController
Constants and properties
| const | HEADERS = array ( 'Content-Type' => 'application/json; charset=UTF-8', 'X-Content-Type-Options' => 'nosniff', 'Access-Control-Expose-Headers' => 'X-WP-Total, X-WP-TotalPages, Link', 'Access-Control-Allow-Headers' => 'Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type', ) |
Public
| static | answer(Minn\Http\Request $request, mixed $data, int $status = 200): Minn\Http\Response# | One item, shaped by the request's own _fields: what nearly every handler ends with. | |||
| static | item(mixed $data, ?Minn\Rest\Fields $fields, int $status = 200): Minn\Http\Response# | One object as a response, the selected fields applied. | |||
| static | alternate(Minn\Http\Response $response, string $permalink): Minn\Http\Response# | A post's answer pointing at its page on the site, as a viewable type's single item does. | |||
| static | list(array $rows, int $total, int $totalPages, ?Minn\Rest\Fields $fields): Minn\Http\Response# | A list response with the total and page-count headers.
| |||
| static | error(Minn\RestError $error): Minn\Http\Response# | A REST error as the reference's error body. |
Nothing matches.