Run Linter

This commit is contained in:
Bradley Schofield
2024-12-16 15:03:57 +09:00
parent b4c77fbd5f
commit 67a72edebf
4 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -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')
+6 -3
View File
@@ -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',
-1
View File
@@ -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;
+12 -10
View File
@@ -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<AuthType> $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;
}
}
}