Documentation

Service
in package
implements IOverrideService Uses UtilsProvider, Service

Create a REST Service.

Table of Contents

Interfaces

IOverrideService

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
since
4.0.9

getPluginConstantPrefix()

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

public getPluginConstantPrefix() : string
Tags
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

getUserSettingsHTML()

See API docs.

public getUserSettingsHTML() : WP_REST_Response|WP_Error
APIYes
Tags
apiName

GetUserSettingsHTML

apiGroup

Folder

apiVersion

1.0.0

apiPermission

upload_files

Return values
WP_REST_Response|WP_Error

permission_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|null

responseModify()

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
apiParam

{string} [currentUrl] The current url to detect the active item

apiName

GetTree

apiGroup

Tree

apiVersion

1.0.0

apiPermission

upload_files

Return values
WP_REST_Response|WP_Error

routeTreeDropdown()

See API docs.

public routeTreeDropdown(WP_REST_Request $request) : WP_REST_Response|WP_Error
APIYes
Parameters
$request : WP_REST_Request
Tags
apiParam

{string} [selected] The selected folder id

apiName

GetTreeDropdown

apiGroup

Tree

apiVersion

1.0.0

apiPermission

upload_files

Return values
WP_REST_Response|WP_Error

updateUserSettings()

See API docs.

public updateUserSettings(WP_REST_Request $request) : WP_REST_Response|WP_Error
APIYes
Parameters
$request : WP_REST_Request
Tags
apiDescription

Send a key value map of form data so UserSettings implementations (IUserSettings) can handle it

apiName

UpdateUserSettings

apiGroup

UserSettings

apiVersion

1.0.0

apiPermission

upload_files

Return values
WP_REST_Response|WP_Error

        
On this page

Search results