From 55275259d92b9d272ea7142b83a0a8fef4568900 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 6 May 2026 13:44:09 +1200 Subject: [PATCH] feat(notifications): scaffold GET /v1/account/alerts endpoint Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Modules/Account/Http/Alerts/XList.php | 65 +++++++++++++++++++ .../Modules/Account/Services/Http.php | 4 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/Appwrite/Platform/Modules/Account/Http/Alerts/XList.php diff --git a/src/Appwrite/Platform/Modules/Account/Http/Alerts/XList.php b/src/Appwrite/Platform/Modules/Account/Http/Alerts/XList.php new file mode 100644 index 0000000000..3f4b60d3b7 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Account/Http/Alerts/XList.php @@ -0,0 +1,65 @@ +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 $queries + */ + public function action( + array $queries, + Response $response, + Database $dbForPlatform, + Document $user + ): void { + $response->dynamic(new Document([ + 'alerts' => [], + 'total' => 0, + ]), Response::MODEL_ALERT_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Account/Services/Http.php b/src/Appwrite/Platform/Modules/Account/Services/Http.php index ae2e841636..4e59807a4d 100644 --- a/src/Appwrite/Platform/Modules/Account/Services/Http.php +++ b/src/Appwrite/Platform/Modules/Account/Services/Http.php @@ -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()); } }