CoolCMS API

ApiClient extends ApiClient
in package

Admin list row of an external Api client (Settings, applications with Api access).

ApiClientMapper builds the rows from the api/system/api-client/get-all response; the key digest is never present (the Api does not send it). The entity also carries the status (enabled / disabled / revoked), allowed role ids and the application keys (Api rows with state active / expiring / expired / revoked, without digest); all for display only.

Attributes
#[Entity]
#[Table]
$name: 'cms_system_api_clients'
#[TableAlias]
'apiClient'

Table of Contents

Constants

KEY_STATE_ACTIVE  : string = 'active'
KEY_STATE_EXPIRED  : string = 'expired'
KEY_STATE_EXPIRING  : string = 'expiring'
KEY_STATE_REVOKED  : string = 'revoked'
STATE_DISABLED  : string = 'disabled'
STATE_ENABLED  : string = 'enabled'
STATE_REVOKED  : string = 'revoked'

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
$activeKeyCount  : int
$keys  : array<int, array<string, mixed>>
$roleIds  : array<int, int>
$state  : string

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActiveKeyCount()  : int
Number of valid keys (neither revoked nor expired).
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
getKeys()  : array<int, array<string, mixed>>
getLastUsedAt()  : DateTime|null
getLimitPerMinute()  : int|null
getLimitPerSecond()  : int|null
getName()  : string
getNotes()  : string|null
getRevokedAt()  : DateTime|null
getRoleIds()  : array<int, int>
getState()  : string
getUpdatedAt()  : DateTime|null
getUserLimitPerMinute()  : int|null
isEnabled()  : bool
isPersisted()  : bool
isRevoked()  : bool
isUsable()  : bool
setActiveKeyCount()  : self
setCreatedAt()  : $this
setEnabled()  : $this
setId()  : $this
setIpLimitPerMinute()  : $this
setKeys()  : self
setLastUsedAt()  : $this
setLimitPerMinute()  : $this
setLimitPerSecond()  : $this
setName()  : $this
setNotes()  : $this
setRevokedAt()  : $this
setRoleIds()  : self
setState()  : self
setUpdatedAt()  : $this
setUserLimitPerMinute()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Constants

KEY_STATE_ACTIVE

public string KEY_STATE_ACTIVE = 'active'

KEY_STATE_EXPIRED

public string KEY_STATE_EXPIRED = 'expired'

KEY_STATE_EXPIRING

public string KEY_STATE_EXPIRING = 'expiring'

KEY_STATE_REVOKED

public string KEY_STATE_REVOKED = 'revoked'

STATE_DISABLED

public string STATE_DISABLED = 'disabled'

STATE_ENABLED

public string STATE_ENABLED = 'enabled'

STATE_REVOKED

public string STATE_REVOKED = 'revoked'

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]

$keys

private array<int, array<string, mixed>> $keys = []

application keys (Api rows: id, keyPrefix, label, createdAt, expiresAt, revokedAt, lastUsedAt, state)

Attributes
#[Transient]

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

getActiveKeyCount()

Number of valid keys (neither revoked nor expired).

public getActiveKeyCount() : int
Return values
int

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

getKeys()

public getKeys() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

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

getRoleIds()

public getRoleIds() : array<int, int>
Return values
array<int, int>

getState()

public getState() : string
Return values
string

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

setActiveKeyCount()

public setActiveKeyCount(int $activeKeyCount) : self
Parameters
$activeKeyCount : int
Return values
self

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

setKeys()

public setKeys(array<int, array<string, mixed>> $keys) : self
Parameters
$keys : array<int, array<string, mixed>>
Return values
self

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

setRoleIds()

public setRoleIds(array<int, int> $roleIds) : self
Parameters
$roleIds : array<int, int>
Return values
self

setState()

public setState(string $state) : self
Parameters
$state : string
Return values
self

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