Service
in package
implements
IOverrideService
Uses
UtilsProvider, Service
Create a REST Service.
Table of Contents
Interfaces
Constants
- LEGACY_NAMESPACE = 'realmedialibrary/v1'
- Legacy namespace while switched from 4.5.4 to 4.6.0 in a new boilerplate.
Properties
- $responseModifier : mixed
Methods
- addResponseModifier() : mixed
- Allows you to modify a given type of response body. If you want to find the different types you must have a look at the Service class constants.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- getUserSettingsHTML() : WP_REST_Response|WP_Error
- See API docs.
- permission_callback() : mixed
- Check if user is allowed to call this service requests.
- permit() : WP_Error|null
- Checks if the current user has a given capability and throws an error if not.
- responseModify() : array<string|int, mixed>
- Apply response modifications to a given array.
- rest_api_init() : mixed
- Register endpoints.
- routeHierarchy() : mixed
- routeTree() : WP_REST_Response|WP_Error
- See API docs.
- routeTreeDropdown() : WP_REST_Response|WP_Error
- See API docs.
- superpwa_exclude_from_cache() : string
- Exclude REST API Url from SuperPWA cache
- updateUserSettings() : WP_REST_Response|WP_Error
- See API docs.
Constants
LEGACY_NAMESPACE
Legacy namespace while switched from 4.5.4 to 4.6.0 in a new boilerplate.
public
mixed
LEGACY_NAMESPACE
= 'realmedialibrary/v1'
Properties
$responseModifier
private
static mixed
$responseModifier
= []
Methods
addResponseModifier()
Allows you to modify a given type of response body. If you want to find the different types you must have a look at the Service class constants.
public
static addResponseModifier(string $type, array<string|int, mixed> $data) : mixed
Parameters
- $type : string
- $data : array<string|int, mixed>
Tags
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringgetUserSettingsHTML()
See API docs.
public
getUserSettingsHTML() : WP_REST_Response|WP_Error
APIYes
Tags
Return values
WP_REST_Response|WP_Errorpermission_callback()
Check if user is allowed to call this service requests.
public
permission_callback() : mixed
permit()
Checks if the current user has a given capability and throws an error if not.
public
static permit([string $cap = 'upload_files' ]) : WP_Error|null
Parameters
- $cap : string = 'upload_files'
-
The capability
Return values
WP_Error|nullresponseModify()
Apply response modifications to a given array.
public
static responseModify(string $type, array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $type : string
- $data : array<string|int, mixed>
Return values
array<string|int, mixed>rest_api_init()
Register endpoints.
public
rest_api_init() : mixed
routeHierarchy()
public
routeHierarchy(mixed $request) : mixed
Parameters
- $request : mixed
routeTree()
See API docs.
public
routeTree(WP_REST_Request $request) : WP_REST_Response|WP_Error
APIYes
Parameters
- $request : WP_REST_Request
Tags
Return values
WP_REST_Response|WP_ErrorrouteTreeDropdown()
See API docs.
public
routeTreeDropdown(WP_REST_Request $request) : WP_REST_Response|WP_Error
APIYes
Parameters
- $request : WP_REST_Request
Tags
Return values
WP_REST_Response|WP_Errorsuperpwa_exclude_from_cache()
Exclude REST API Url from SuperPWA cache
public
superpwa_exclude_from_cache(string $superpwa_sw_never_cache_urls) : string
Parameters
- $superpwa_sw_never_cache_urls : string
Tags
Return values
stringupdateUserSettings()
See API docs.
public
updateUserSettings(WP_REST_Request $request) : WP_REST_Response|WP_Error
APIYes
Parameters
- $request : WP_REST_Request