mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
merge: ST7 alerts XList skeleton
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\Account\Http\Alerts;
|
||||
|
||||
use Appwrite\SDK\AuthType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Database\Validator\Queries\Alerts;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
|
||||
class XList extends Action
|
||||
{
|
||||
use HTTP;
|
||||
|
||||
public static function getName(): string
|
||||
{
|
||||
return 'listAlerts';
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this
|
||||
->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET)
|
||||
->setHttpPath('/v1/account/alerts')
|
||||
->desc('List alerts')
|
||||
->groups(['api', 'account'])
|
||||
->label('scope', 'account')
|
||||
->label('sdk', new Method(
|
||||
namespace: 'account',
|
||||
name: 'listAlerts',
|
||||
description: '/docs/references/account/list-alerts.md',
|
||||
auth: [AuthType::SESSION, AuthType::JWT],
|
||||
responses: [
|
||||
new SDKResponse(
|
||||
code: Response::STATUS_CODE_OK,
|
||||
model: Response::MODEL_ALERT_LIST,
|
||||
)
|
||||
]
|
||||
))
|
||||
->param('queries', [], new Alerts(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Alerts::ALLOWED_ATTRIBUTES), true)
|
||||
->inject('response')
|
||||
->inject('dbForPlatform')
|
||||
->inject('user')
|
||||
->callback($this->action(...));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string> $queries
|
||||
*/
|
||||
public function action(
|
||||
array $queries,
|
||||
Response $response,
|
||||
Database $dbForPlatform,
|
||||
Document $user
|
||||
): void {
|
||||
$response->dynamic(new Document([
|
||||
'alerts' => [],
|
||||
'total' => 0,
|
||||
]), Response::MODEL_ALERT_LIST);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ use Appwrite\Platform\Modules\Account\Http\Account\MFA\RecoveryCodes\Create as C
|
||||
use Appwrite\Platform\Modules\Account\Http\Account\MFA\RecoveryCodes\Get as GetRecoveryCodes;
|
||||
use Appwrite\Platform\Modules\Account\Http\Account\MFA\RecoveryCodes\Update as UpdateRecoveryCodes;
|
||||
use Appwrite\Platform\Modules\Account\Http\Account\MFA\Update as UpdateMfa;
|
||||
use Appwrite\Platform\Modules\Account\Http\Alerts\XList as ListAlerts;
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
class Http extends Service
|
||||
@@ -29,6 +30,7 @@ class Http extends Service
|
||||
->addAction(UpdateRecoveryCodes::getName(), new UpdateRecoveryCodes())
|
||||
->addAction(GetRecoveryCodes::getName(), new GetRecoveryCodes())
|
||||
->addAction(CreateChallenge::getName(), new CreateChallenge())
|
||||
->addAction(UpdateChallenge::getName(), new UpdateChallenge());
|
||||
->addAction(UpdateChallenge::getName(), new UpdateChallenge())
|
||||
->addAction(ListAlerts::getName(), new ListAlerts());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user