UserApiClientEvent events
4 FeatherPanel plugin events on UserApiClientEvent (3 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.
Last synced from FeatherPanel 15b94e9 on .
On this page
Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions. 1 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import UserApiClientEvent in your entry class and register listeners in processEvents():
<?php
namespace App\Addons\myplugin;
use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\UserApiClientEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(UserApiClientEvent::onUserApiClientDeleted(), function ($userUuid, $apiClient): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:deleted ' . json_encode(['user_uuid' => $userUuid, 'api_client' => $apiClient]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}UserApiClientEvent::onUserApiClientCreated()
Docblock: array api_client data. (the emitter passes 2 values, see the table)
Same event name as UserEvent::onUserApiKeyCreated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | api_client | $apiClient | not declared |
When it fires (1 site)
$event->on(UserApiClientEvent::onUserApiClientCreated(), function ($userUuid, $apiClient): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:created');
});UserApiClientEvent::onUserApiClientDeleted()
Docblock: int api_client id, array api_client data.
Same event name as UserEvent::onUserApiKeyDeleted(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | intfrom docblock |
| 2 | api_client | $apiClient | arrayfrom docblock |
When it fires (1 site)
$event->on(UserApiClientEvent::onUserApiClientDeleted(), function ($userUuid, $apiClient): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:deleted ' . json_encode(['user_uuid' => $userUuid, 'api_client' => $apiClient]));
});UserApiClientEvent::onUserApiClientError()
Docblock: string error message, array context.
$event->on(UserApiClientEvent::onUserApiClientError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
UserApiClientEvent::onUserApiClientUpdated()
Docblock: int api_client id, array updated data. (the emitter passes 3 values, see the table)
Same event name as UserEvent::onUserApiKeyUpdated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | api_client | $apiClient | not declared |
| 3 | updated_data | $updatedDatanot at every site | not declared |
| Arguments passed | Emitted from |
|---|---|
user_uuid, api_client, updated_data | ApiClientController::updateApiClient |
user_uuid, api_client, action | ApiClientController::regenerateApiKeys |
When it fires (2 sites)
$event->on(UserApiClientEvent::onUserApiClientUpdated(), function ($userUuid, $apiClient, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:api_client:updated');
});