Documentation

EndpointBase
in package

AbstractYes

Base class endpoints need to extend.

Tags
author

Aberdeener

version
2.0.0-pr13
license

MIT

Table of Contents

Constants

AUTH_TYPE_API_KEY  = 'API Key'
AUTH_TYPE_CUSTOM  = 'Custom'
AUTH_TYPE_NONE  = 'None'

Properties

$_description  : string
$_method  : string
$_module  : string
$_route  : string

Methods

customParams()  : array<string|int, mixed>
Allow auth methods to add custom params to endpoint.
getAuthType()  : string
Get the authentication type of this Endpoint.
getDescription()  : string
Get description of this Endpoint.
getMethod()  : string
Get method of this Endpoint (either `POST` or `GET`).
getModule()  : string
Get name of module of this Endpoint.
getRoute()  : string
Get route of this Endpoint.
isAuthorised()  : bool
Determine if this request is authorized to use this Endpoint.

Constants

AUTH_TYPE_API_KEY

public mixed AUTH_TYPE_API_KEY = 'API Key'

AUTH_TYPE_CUSTOM

public mixed AUTH_TYPE_CUSTOM = 'Custom'

Properties

Methods

customParams()

Allow auth methods to add custom params to endpoint.

public customParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —

Custom endpoint params

getAuthType()

Get the authentication type of this Endpoint.

public final getAuthType() : string

Determined by seeing what class it extends. Used to display in the API Endpoints StaffCP page.

Return values
string —

The auth type.

getDescription()

Get description of this Endpoint.

public final getDescription() : string
Return values
string —

Endpoint's description.

getMethod()

Get method of this Endpoint (either `POST` or `GET`).

public final getMethod() : string
Return values
string —

Endpoint's method.

getModule()

Get name of module of this Endpoint.

public final getModule() : string
Return values
string —

Endpoint's modules name.

getRoute()

Get route of this Endpoint.

public final getRoute() : string
Return values
string —

Endpoint's route.

isAuthorised()

Determine if this request is authorized to use this Endpoint.

public abstract isAuthorised(Nameless2API $api) : bool

Default implementations:

  • NoAuthEndpoint to return true
  • KeyAuthEndpoint to return true if the API key in header is valid.
Parameters
$api : Nameless2API

Instance of Nameless2API.

Return values
bool

        
On this page

Search results