mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
chore: changed directory structure for devkeys
This commit is contained in:
parent
b4849cd6ca
commit
9420340871
9 changed files with 122 additions and 71 deletions
|
|
@ -3,7 +3,7 @@
|
|||
namespace Appwrite\Platform;
|
||||
|
||||
use Appwrite\Platform\Modules\Core;
|
||||
use Appwrite\Platform\Modules\DevKeys;
|
||||
use Appwrite\Platform\Modules\Projects;
|
||||
use Utopia\Platform\Platform;
|
||||
|
||||
class Appwrite extends Platform
|
||||
|
|
@ -11,6 +11,6 @@ class Appwrite extends Platform
|
|||
public function __construct()
|
||||
{
|
||||
parent::__construct(new Core());
|
||||
$this->addModule(new DevKeys\Module());
|
||||
$this->addModule(new Projects\Module());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\DevKeys\Services;
|
||||
|
||||
use Appwrite\Platform\Modules\DevKeys\Http\DevKeys\CreateKey;
|
||||
use Appwrite\Platform\Modules\DevKeys\Http\DevKeys\DeleteKey;
|
||||
use Appwrite\Platform\Modules\DevKeys\Http\DevKeys\GetKey;
|
||||
use Appwrite\Platform\Modules\DevKeys\Http\DevKeys\ListKeys;
|
||||
use Appwrite\Platform\Modules\DevKeys\Http\DevKeys\UpdateKey;
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
class Http extends Service
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Service::TYPE_HTTP;
|
||||
$this->addAction(CreateKey::getName(), new CreateKey());
|
||||
$this->addAction(UpdateKey::getName(), new UpdateKey());
|
||||
$this->addAction(GetKey::getName(), new GetKey());
|
||||
$this->addAction(ListKeys::getName(), new ListKeys());
|
||||
$this->addAction(DeleteKey::getName(), new DeleteKey());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\DevKeys\Http\DevKeys;
|
||||
namespace Appwrite\Platform\Modules\Projects\Http\DevKeys;
|
||||
|
||||
use Appwrite\Extend\Exception;
|
||||
use Appwrite\SDK\ContentType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Document;
|
||||
|
|
@ -15,12 +18,12 @@ use Utopia\Platform\Action;
|
|||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Validator\Text;
|
||||
|
||||
class CreateKey extends Action
|
||||
class CreateDevKey extends Action
|
||||
{
|
||||
use HTTP;
|
||||
public static function getName()
|
||||
{
|
||||
return 'createKey';
|
||||
return 'createDevKey';
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
|
|
@ -31,12 +34,19 @@ class CreateKey extends Action
|
|||
->desc('Create dev key')
|
||||
->groups(['api', 'projects'])
|
||||
->label('scope', 'projects.write')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
|
||||
->label('sdk.namespace', 'projects')
|
||||
->label('sdk.method', 'createDevKey')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_DEV_KEY)
|
||||
->label('sdk', new Method(
|
||||
namespace: 'projects',
|
||||
name: 'createDevKey',
|
||||
description: '',
|
||||
auth: [AuthType::ADMIN],
|
||||
responses: [
|
||||
new SDKResponse(
|
||||
code: Response::STATUS_CODE_CREATED,
|
||||
model: Response::MODEL_DEV_KEY
|
||||
)
|
||||
],
|
||||
contentType: ContentType::JSON
|
||||
))
|
||||
->param('projectId', '', new UID(), 'Project unique ID.')
|
||||
->param('name', null, new Text(128), 'Key name. Max length: 128 chars.')
|
||||
->param('expire', null, new DatetimeValidator(), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.', false)
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\DevKeys\Http\DevKeys;
|
||||
namespace Appwrite\Platform\Modules\Projects\Http\DevKeys;
|
||||
|
||||
use Appwrite\Extend\Exception;
|
||||
use Appwrite\SDK\ContentType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Query;
|
||||
|
|
@ -10,12 +13,12 @@ use Utopia\Database\Validator\UID;
|
|||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
|
||||
class DeleteKey extends Action
|
||||
class DeleteDevKey extends Action
|
||||
{
|
||||
use HTTP;
|
||||
public static function getName()
|
||||
{
|
||||
return 'deleteKey';
|
||||
return 'deleteDevKey';
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
|
|
@ -26,11 +29,19 @@ class DeleteKey extends Action
|
|||
->desc('Delete dev key')
|
||||
->groups(['api', 'projects'])
|
||||
->label('scope', 'projects.write')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
|
||||
->label('sdk.namespace', 'projects')
|
||||
->label('sdk.method', 'deleteDevKey')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
|
||||
->label('sdk.response.model', Response::MODEL_NONE)
|
||||
->label('sdk', new Method(
|
||||
namespace: 'projects',
|
||||
name: 'deleteDevKey',
|
||||
description: '',
|
||||
auth: [AuthType::ADMIN],
|
||||
responses: [
|
||||
new SDKResponse(
|
||||
code: Response::STATUS_CODE_CREATED,
|
||||
model: Response::MODEL_NONE
|
||||
)
|
||||
],
|
||||
contentType: ContentType::NONE
|
||||
))
|
||||
->param('projectId', '', new UID(), 'Project unique ID.')
|
||||
->param('keyId', '', new UID(), 'Key unique ID.')
|
||||
->inject('response')
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\DevKeys\Http\DevKeys;
|
||||
namespace Appwrite\Platform\Modules\Projects\Http\DevKeys;
|
||||
|
||||
use Appwrite\Extend\Exception;
|
||||
use Appwrite\SDK\ContentType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Query;
|
||||
|
|
@ -10,12 +13,12 @@ use Utopia\Database\Validator\UID;
|
|||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
|
||||
class GetKey extends Action
|
||||
class GetDevKey extends Action
|
||||
{
|
||||
use HTTP;
|
||||
public static function getName()
|
||||
{
|
||||
return 'getKey';
|
||||
return 'getDevKey';
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
|
|
@ -26,12 +29,19 @@ class GetKey extends Action
|
|||
->desc('Get dev key')
|
||||
->groups(['api', 'projects'])
|
||||
->label('scope', 'projects.read')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
|
||||
->label('sdk.namespace', 'projects')
|
||||
->label('sdk.method', 'getDevKey')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_DEV_KEY)
|
||||
->label('sdk', new Method(
|
||||
namespace: 'projects',
|
||||
name: 'getDevKey',
|
||||
description: '',
|
||||
auth: [AuthType::ADMIN],
|
||||
responses: [
|
||||
new SDKResponse(
|
||||
code: Response::STATUS_CODE_OK,
|
||||
model: Response::MODEL_DEV_KEY
|
||||
)
|
||||
],
|
||||
contentType: ContentType::JSON
|
||||
))
|
||||
->param('projectId', '', new UID(), 'Project unique ID.')
|
||||
->param('keyId', '', new UID(), 'Key unique ID.')
|
||||
->inject('response')
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\DevKeys\Http\DevKeys;
|
||||
namespace Appwrite\Platform\Modules\Projects\Http\DevKeys;
|
||||
|
||||
use Appwrite\Extend\Exception;
|
||||
use Appwrite\SDK\ContentType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Document;
|
||||
|
|
@ -11,12 +14,12 @@ use Utopia\Database\Validator\UID;
|
|||
use Utopia\Platform\Action;
|
||||
use Utopia\Platform\Scope\HTTP;
|
||||
|
||||
class ListKeys extends Action
|
||||
class ListDevKeys extends Action
|
||||
{
|
||||
use HTTP;
|
||||
public static function getName()
|
||||
{
|
||||
return 'listKeys';
|
||||
return 'listDevKeys';
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
|
|
@ -27,12 +30,19 @@ class ListKeys extends Action
|
|||
->desc('List dev keys')
|
||||
->groups(['api', 'projects'])
|
||||
->label('scope', 'projects.read')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
|
||||
->label('sdk.namespace', 'projects')
|
||||
->label('sdk.method', 'listDevKeys')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_DEV_KEY_LIST)
|
||||
->label('sdk', new Method(
|
||||
namespace: 'projects',
|
||||
name: 'listDevKeys',
|
||||
description: '',
|
||||
auth: [AuthType::ADMIN],
|
||||
responses: [
|
||||
new SDKResponse(
|
||||
code: Response::STATUS_CODE_CREATED,
|
||||
model: Response::MODEL_DEV_KEY_LIST
|
||||
)
|
||||
],
|
||||
contentType: ContentType::JSON
|
||||
))
|
||||
->param('projectId', '', new UID(), 'Project unique ID.')
|
||||
->inject('response')
|
||||
->inject('dbForPlatform')
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\DevKeys\Http\DevKeys;
|
||||
namespace Appwrite\Platform\Modules\Projects\Http\DevKeys;
|
||||
|
||||
use Appwrite\Extend\Exception;
|
||||
use Appwrite\SDK\ContentType;
|
||||
use Appwrite\SDK\Method;
|
||||
use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Query;
|
||||
|
|
@ -12,12 +15,12 @@ use Utopia\Platform\Action;
|
|||
use Utopia\Platform\Scope\HTTP;
|
||||
use Utopia\Validator\Text;
|
||||
|
||||
class UpdateKey extends Action
|
||||
class UpdateDevKey extends Action
|
||||
{
|
||||
use HTTP;
|
||||
public static function getName()
|
||||
{
|
||||
return 'updateKey';
|
||||
return 'updateDevKey';
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
|
|
@ -27,12 +30,19 @@ class UpdateKey extends Action
|
|||
->desc('Update dev key')
|
||||
->groups(['api', 'projects'])
|
||||
->label('scope', 'projects.write')
|
||||
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
|
||||
->label('sdk.namespace', 'projects')
|
||||
->label('sdk.method', 'updateDevKey')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_DEV_KEY)
|
||||
->label('sdk', new Method(
|
||||
namespace: 'projects',
|
||||
name: 'updateDevKey',
|
||||
description: '',
|
||||
auth: [AuthType::ADMIN],
|
||||
responses: [
|
||||
new SDKResponse(
|
||||
code: Response::STATUS_CODE_CREATED,
|
||||
model: Response::MODEL_DEV_KEY
|
||||
)
|
||||
],
|
||||
contentType: ContentType::JSON
|
||||
))
|
||||
->param('projectId', '', new UID(), 'Project unique ID.')
|
||||
->param('keyId', '', new UID(), 'Key unique ID.')
|
||||
->param('name', null, new Text(128), 'Key name. Max length: 128 chars.')
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\DevKeys;
|
||||
namespace Appwrite\Platform\Modules\Projects;
|
||||
|
||||
use Appwrite\Platform\Modules\DevKeys\Services\Http;
|
||||
use Appwrite\Platform\Modules\Projects\Services\Http;
|
||||
use Utopia\Platform\Module as Base;
|
||||
|
||||
class Module extends Base
|
||||
23
src/Appwrite/Platform/Modules/Projects/Services/Http.php
Normal file
23
src/Appwrite/Platform/Modules/Projects/Services/Http.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Platform\Modules\Projects\Services;
|
||||
|
||||
use Appwrite\Platform\Modules\Projects\Http\DevKeys\CreateDevKey;
|
||||
use Appwrite\Platform\Modules\Projects\Http\DevKeys\DeleteDevKey;
|
||||
use Appwrite\Platform\Modules\Projects\Http\DevKeys\GetDevKey;
|
||||
use Appwrite\Platform\Modules\Projects\Http\DevKeys\ListDevKeys;
|
||||
use Appwrite\Platform\Modules\Projects\Http\DevKeys\UpdateDevKey;
|
||||
use Utopia\Platform\Service;
|
||||
|
||||
class Http extends Service
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = Service::TYPE_HTTP;
|
||||
$this->addAction(CreateDevKey::getName(), new CreateDevKey());
|
||||
$this->addAction(UpdateDevKey::getName(), new UpdateDevKey());
|
||||
$this->addAction(GetDevKey::getName(), new GetDevKey());
|
||||
$this->addAction(ListDevKeys::getName(), new ListDevKeys());
|
||||
$this->addAction(DeleteDevKey::getName(), new DeleteDevKey());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue