CoolCMS API

ApiClient extends ApiClient
in package

Client of the external Api: an application allowed to call the Api with its key (`X-API-Key`).

The key only says "this application may call the Api"; the data returned is decided by the roles of the user from the JWT (or guest). A client can only restrict them: allowed roles live in the join table cms_system_api_client_roles (read and written by ApiClientManager, the entity does not map them). It carries own request limits (null = default from api.clientKey.limits).

Application keys live in a separate table cms_system_api_client_keys (ApiClientKey); an application may have several, each with an optional expiry. There is no key fingerprint here; lastUsedAt is a summary over all its keys.

Attributes
#[Entity]
#[Index]
$name: 'idx_api_client_enabled'
$columns: ['enabled']
#[Table]
$name: 'cms_system_api_clients'
#[TableAlias]
'apiClient'

Table of Contents

Properties

$createdAt  : DateTime|null
$enabled  : bool
$id  : int|null
$ipLimitPerMinute  : int|null
$lastUsedAt  : DateTime|null
$limitPerMinute  : int|null
$limitPerSecond  : int|null
$name  : string
$notes  : string|null
$revokedAt  : DateTime|null
$updatedAt  : DateTime|null
$userLimitPerMinute  : int|null

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getCreatedAt()  : DateTime|null
getEnabled()  : bool
getId()  : int|null
getIpLimitPerMinute()  : int|null
getLastUsedAt()  : DateTime|null
getLimitPerMinute()  : int|null
getLimitPerSecond()  : int|null
getName()  : string
getNotes()  : string|null
getRevokedAt()  : DateTime|null
getUpdatedAt()  : DateTime|null
getUserLimitPerMinute()  : int|null
isEnabled()  : bool
isPersisted()  : bool
isRevoked()  : bool
isUsable()  : bool
setCreatedAt()  : $this
setEnabled()  : $this
setId()  : $this
setIpLimitPerMinute()  : $this
setLastUsedAt()  : $this
setLimitPerMinute()  : $this
setLimitPerSecond()  : $this
setName()  : $this
setNotes()  : $this
setRevokedAt()  : $this
setUpdatedAt()  : $this
setUserLimitPerMinute()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$createdAt

protected DateTime|null $createdAt = null
Attributes
#[Column]
$name: 'created_at'
$type: 'datetime'

$enabled

protected bool $enabled = true
Attributes
#[Column]
$name: 'enabled'
$type: 'boolean'
$options: ['default' => true]

$id

protected int|null $id = null
Attributes
#[Column]
$type: 'integer'
$name: 'api_client_id'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$ipLimitPerMinute

protected int|null $ipLimitPerMinute = null
Attributes
#[Column]
$name: 'ip_limit_per_minute'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$lastUsedAt

protected DateTime|null $lastUsedAt = null
Attributes
#[Column]
$name: 'last_used_at'
$type: 'datetime'
$nullable: true

$limitPerMinute

protected int|null $limitPerMinute = null
Attributes
#[Column]
$name: 'limit_per_minute'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$limitPerSecond

protected int|null $limitPerSecond = null
Attributes
#[Column]
$name: 'limit_per_second'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$name

protected string $name = ''
Attributes
#[Column]
$name: 'name'
$type: 'string'
$length: 100

$notes

protected string|null $notes = null
Attributes
#[Column]
$name: 'notes'
$type: 'string'
$length: 255
$nullable: true

$revokedAt

protected DateTime|null $revokedAt = null
Attributes
#[Column]
$name: 'revoked_at'
$type: 'datetime'
$nullable: true

$updatedAt

protected DateTime|null $updatedAt = null
Attributes
#[Column]
$name: 'updated_at'
$type: 'datetime'
$nullable: true

$userLimitPerMinute

protected int|null $userLimitPerMinute = null
Attributes
#[Column]
$name: 'user_limit_per_minute'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

Methods

__construct()

public __construct([int|null $id = null ][, string $name = '' ][, bool $enabled = true ][, DateTime|null $createdAt = null ][, DateTime|null $revokedAt = null ][, DateTime|null $lastUsedAt = null ][, DateTime|null $updatedAt = null ][, string|null $notes = null ][, int|null $limitPerSecond = null ][, int|null $limitPerMinute = null ][, int|null $userLimitPerMinute = null ][, int|null $ipLimitPerMinute = null ]) : mixed
Parameters
$id : int|null = null
$name : string = ''
$enabled : bool = true
$createdAt : DateTime|null = null
$revokedAt : DateTime|null = null
$lastUsedAt : DateTime|null = null
$updatedAt : DateTime|null = null
$notes : string|null = null
$limitPerSecond : int|null = null
$limitPerMinute : int|null = null
$userLimitPerMinute : int|null = null
$ipLimitPerMinute : int|null = null

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getCreatedAt()

public getCreatedAt() : DateTime|null
Return values
DateTime|null

getEnabled()

public getEnabled() : bool
Return values
bool

getIpLimitPerMinute()

public getIpLimitPerMinute() : int|null
Return values
int|null

getLastUsedAt()

public getLastUsedAt() : DateTime|null
Return values
DateTime|null

getLimitPerMinute()

public getLimitPerMinute() : int|null
Return values
int|null

getLimitPerSecond()

public getLimitPerSecond() : int|null
Return values
int|null

getName()

public getName() : string
Return values
string

getNotes()

public getNotes() : string|null
Return values
string|null

getRevokedAt()

public getRevokedAt() : DateTime|null
Return values
DateTime|null

getUpdatedAt()

public getUpdatedAt() : DateTime|null
Return values
DateTime|null

getUserLimitPerMinute()

public getUserLimitPerMinute() : int|null
Return values
int|null

isEnabled()

public isEnabled() : bool
Return values
bool

isRevoked()

public isRevoked() : bool
Return values
bool

isUsable()

public isUsable() : bool
Return values
bool

setCreatedAt()

public setCreatedAt(DateTime|null $createdAt) : $this
Parameters
$createdAt : DateTime|null
Return values
$this

setEnabled()

public setEnabled(bool $enabled) : $this
Parameters
$enabled : bool
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setIpLimitPerMinute()

public setIpLimitPerMinute(int|null $ipLimitPerMinute) : $this
Parameters
$ipLimitPerMinute : int|null
Return values
$this

setLastUsedAt()

public setLastUsedAt(DateTime|null $lastUsedAt) : $this
Parameters
$lastUsedAt : DateTime|null
Return values
$this

setLimitPerMinute()

public setLimitPerMinute(int|null $limitPerMinute) : $this
Parameters
$limitPerMinute : int|null
Return values
$this

setLimitPerSecond()

public setLimitPerSecond(int|null $limitPerSecond) : $this
Parameters
$limitPerSecond : int|null
Return values
$this

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setNotes()

public setNotes(string|null $notes) : $this
Parameters
$notes : string|null
Return values
$this

setRevokedAt()

public setRevokedAt(DateTime|null $revokedAt) : $this
Parameters
$revokedAt : DateTime|null
Return values
$this

setUpdatedAt()

public setUpdatedAt(DateTime|null $updatedAt) : $this
Parameters
$updatedAt : DateTime|null
Return values
$this

setUserLimitPerMinute()

public setUserLimitPerMinute(int|null $userLimitPerMinute) : $this
Parameters
$userLimitPerMinute : int|null
Return values
$this

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results