From 67a72edebfa6548ab4bb115dccf26412df62e274 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 16 Dec 2024 15:03:57 +0900 Subject: [PATCH] Run Linter --- app/controllers/api/account.php | 2 +- app/controllers/api/functions.php | 9 ++++++--- app/controllers/api/messaging.php | 1 - src/Appwrite/SDK/Method.php | 22 ++++++++++++---------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 1b8c3ac30e..585f1bcecb 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -3808,7 +3808,7 @@ App::post('/v1/account/mfa/authenticators/:type') responseModel: Response::MODEL_MFA_TYPE, offlineModel: '/account', offlineKey: 'current' - )) + )) ->param('type', null, new WhiteList([Type::TOTP]), 'Type of authenticator. Must be `' . Type::TOTP . '`') ->inject('requestTimestamp') ->inject('response') diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 1d485538ee..82ac617e79 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1688,7 +1688,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId/build') ->label('scope', 'functions.write') ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) ->label('audits.event', 'deployment.update') - ->label('audits.resource', 'function/{request.functionId}') + ->label('audits.resource', 'function/{request.functionId}') ->label('sdk', new Method( namespace: 'functions', name: 'updateDeploymentBuild', @@ -2464,7 +2464,8 @@ App::get('/v1/functions/:functionId/variables') ->desc('List variables') ->groups(['api', 'functions']) ->label('scope', 'functions.read') - ->label('sdk', + ->label( + 'sdk', new Method( namespace: 'functions', name: 'listVariables', @@ -2496,7 +2497,9 @@ App::get('/v1/functions/:functionId/variables/:variableId') ->groups(['api', 'functions']) ->label('scope', 'functions.read') ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) - ->label('sdk', new Method( + ->label( + 'sdk', + new Method( namespace: 'functions', name: 'getVariable', description: '/docs/references/functions/get-variable.md', diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index fbeb38e355..54d8a7577e 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -23,7 +23,6 @@ use Appwrite\Utopia\Database\Validator\Queries\Targets; use Appwrite\Utopia\Database\Validator\Queries\Topics; use Appwrite\Utopia\Response; use MaxMind\Db\Reader; -use Tests\Unit\Auth\AuthTest; use Utopia\App; use Utopia\Audit\Audit; use Utopia\Database\Database; diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index 0ae9451b6c..4f0c4f9725 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -5,21 +5,24 @@ namespace Appwrite\SDK; use Appwrite\Utopia\Response; use Swoole\Http\Response as HttpResponse; -enum AuthType: string { +enum AuthType: string +{ case JWT = APP_AUTH_TYPE_JWT; case KEY = APP_AUTH_TYPE_KEY; case SESSION = APP_AUTH_TYPE_SESSION; case ADMIN = APP_AUTH_TYPE_ADMIN; } -enum MethodType: string { +enum MethodType: string +{ case WEBAUTH = 'webAuth'; case LOCATION = 'location'; case GRAPHQL = 'graphql'; case UPLOAD = 'upload'; } -enum ResponseType: string { +enum ResponseType: string +{ case NONE = ''; case JSON = 'application/json'; case IMAGE = 'image/*'; @@ -32,11 +35,11 @@ enum ResponseType: string { class Method { - static array $knownMethods = []; + public static array $knownMethods = []; /** * Initialise a new SDK method - * + * * @param array $authTypes * @param string $namespace * @param MethodType $methodType @@ -45,7 +48,7 @@ class Method * @param string $responseModel * @param string $offlineKey * @param string $offlineModel - * + * * @throws \Exception */ public function __construct( @@ -65,12 +68,11 @@ class Method protected bool $packaging = false, protected string $requestType = 'application/json', protected array $parameters = [], - ) - { + ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); // Disabled for now, will be enabled later - // $this->validateDesc($description); + // $this->validateDesc($description); $this->validateResponseModel($responseModel); // No content check @@ -219,4 +221,4 @@ class Method { return $this->parameters; } -} \ No newline at end of file +}