Added key response model
This commit is contained in:
parent
120da9cef9
commit
c952ece8d4
4 changed files with 123 additions and 14 deletions
|
@ -18,14 +18,14 @@ $scopes = $this->getParam('scopes', []);
|
||||||
data-success="trigger"
|
data-success="trigger"
|
||||||
data-success-param-trigger-events="projects.listKeys">
|
data-success-param-trigger-events="projects.listKeys">
|
||||||
|
|
||||||
<div data-ls-if="0 == {{console-keys.length}} || undefined == {{console-keys.length}}" class="box margin-top margin-bottom">
|
<div data-ls-if="0 == {{console-keys.sum}} || undefined == {{console-keys.sum}}" class="box margin-top margin-bottom">
|
||||||
<h3 class="margin-bottom-small text-bold">No API Keys Found</h3>
|
<h3 class="margin-bottom-small text-bold">No API Keys Found</h3>
|
||||||
|
|
||||||
<p class="margin-bottom-no">You haven't created any API keys for your project yet.</p>
|
<p class="margin-bottom-no">You haven't created any API keys for your project yet.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box margin-bottom" data-ls-if="0 != {{console-keys.length}}">
|
<div class="box margin-bottom" data-ls-if="0 != {{console-keys.sum}}">
|
||||||
<ul data-ls-loop="console-keys" data-ls-as="key" class="list">
|
<ul data-ls-loop="console-keys.keys" data-ls-as="key" class="list">
|
||||||
<li class="clear">
|
<li class="clear">
|
||||||
<div data-ui-modal class="modal box close" data-button-alias="none" data-open-event="key-update-{{key.$id}}">
|
<div data-ui-modal class="modal box close" data-button-alias="none" data-open-event="key-update-{{key.$id}}">
|
||||||
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
|
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
|
||||||
|
|
70
composer.lock
generated
70
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "a95c05370522cef7f6042467a9adf219",
|
"content-hash": "fa5ca1bd60c2ebb41f76803af55744a8",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "appwrite/php-clamav",
|
"name": "appwrite/php-clamav",
|
||||||
|
@ -1861,16 +1861,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/preloader",
|
"name": "utopia-php/preloader",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/utopia-php/preloader.git",
|
"url": "https://github.com/utopia-php/preloader.git",
|
||||||
"reference": "43e126b6c056e9a2c6a6f31f996f774e0072a22f"
|
"reference": "e710e7cf38605dd67c6cc599dd1150735765ad2e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/utopia-php/preloader/zipball/43e126b6c056e9a2c6a6f31f996f774e0072a22f",
|
"url": "https://api.github.com/repos/utopia-php/preloader/zipball/e710e7cf38605dd67c6cc599dd1150735765ad2e",
|
||||||
"reference": "43e126b6c056e9a2c6a6f31f996f774e0072a22f",
|
"reference": "e710e7cf38605dd67c6cc599dd1150735765ad2e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1905,7 +1905,7 @@
|
||||||
"upf",
|
"upf",
|
||||||
"utopia"
|
"utopia"
|
||||||
],
|
],
|
||||||
"time": "2020-08-14T17:34:39+00:00"
|
"time": "2020-08-14T23:17:55+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/registry",
|
"name": "utopia-php/registry",
|
||||||
|
@ -1953,6 +1953,56 @@
|
||||||
"utopia"
|
"utopia"
|
||||||
],
|
],
|
||||||
"time": "2020-07-04T22:14:07+00:00"
|
"time": "2020-07-04T22:14:07+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "utopia-php/swoole",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/utopia-php/swoole.git",
|
||||||
|
"reference": "26965d8122cb42769a5543c3be1677321cdaebdb"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/utopia-php/swoole/zipball/26965d8122cb42769a5543c3be1677321cdaebdb",
|
||||||
|
"reference": "26965d8122cb42769a5543c3be1677321cdaebdb",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1",
|
||||||
|
"utopia-php/framework": "0.*.*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^7.0",
|
||||||
|
"swoole/ide-helper": "4.5.2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Utopia\\Swoole\\": "src/Swoole"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Eldad Fux",
|
||||||
|
"email": "team@appwrite.io"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "An extension for Utopia Framework to work with PHP Swoole as a PHP FPM alternative",
|
||||||
|
"keywords": [
|
||||||
|
"framework",
|
||||||
|
"http",
|
||||||
|
"php",
|
||||||
|
"server",
|
||||||
|
"swoole",
|
||||||
|
"upf",
|
||||||
|
"utopia"
|
||||||
|
],
|
||||||
|
"time": "2020-08-14T22:44:34+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
|
@ -2364,12 +2414,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||||
"reference": "584a54ca0dadeee4e07c959e24fe61ffa4df22a2"
|
"reference": "f3ab30788f7d3e90c065c70a1658a464b8beff91"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/584a54ca0dadeee4e07c959e24fe61ffa4df22a2",
|
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f3ab30788f7d3e90c065c70a1658a464b8beff91",
|
||||||
"reference": "584a54ca0dadeee4e07c959e24fe61ffa4df22a2",
|
"reference": "f3ab30788f7d3e90c065c70a1658a464b8beff91",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -2408,7 +2458,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||||
"time": "2020-08-12T17:52:10+00:00"
|
"time": "2020-08-15T12:16:28+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpdocumentor/type-resolver",
|
"name": "phpdocumentor/type-resolver",
|
||||||
|
|
|
@ -13,6 +13,7 @@ use Appwrite\Utopia\Response\Model\ErrorDev;
|
||||||
use Appwrite\Utopia\Response\Model\Execution;
|
use Appwrite\Utopia\Response\Model\Execution;
|
||||||
use Appwrite\Utopia\Response\Model\File;
|
use Appwrite\Utopia\Response\Model\File;
|
||||||
use Appwrite\Utopia\Response\Model\Func;
|
use Appwrite\Utopia\Response\Model\Func;
|
||||||
|
use Appwrite\Utopia\Response\Model\Key;
|
||||||
use Appwrite\Utopia\Response\Model\User;
|
use Appwrite\Utopia\Response\Model\User;
|
||||||
use Appwrite\Utopia\Response\Model\Session;
|
use Appwrite\Utopia\Response\Model\Session;
|
||||||
use Appwrite\Utopia\Response\Model\Team;
|
use Appwrite\Utopia\Response\Model\Team;
|
||||||
|
@ -101,7 +102,7 @@ class Response extends SwooleResponse
|
||||||
->setModel(new BaseList('Executions List', self::MODEL_EXECUTION_LIST, 'executions', self::MODEL_EXECUTION))
|
->setModel(new BaseList('Executions List', self::MODEL_EXECUTION_LIST, 'executions', self::MODEL_EXECUTION))
|
||||||
->setModel(new BaseList('Projects List', self::MODEL_EXECUTION_LIST, 'projects', self::MODEL_EXECUTION))
|
->setModel(new BaseList('Projects List', self::MODEL_EXECUTION_LIST, 'projects', self::MODEL_EXECUTION))
|
||||||
->setModel(new BaseList('Webhooks List', self::MODEL_EXECUTION_LIST, 'webhooks', self::MODEL_EXECUTION))
|
->setModel(new BaseList('Webhooks List', self::MODEL_EXECUTION_LIST, 'webhooks', self::MODEL_EXECUTION))
|
||||||
->setModel(new BaseList('API Keys List', self::MODEL_EXECUTION_LIST, 'keyss', self::MODEL_EXECUTION))
|
->setModel(new BaseList('API Keys List', self::MODEL_KEY_LIST, 'keys', self::MODEL_KEY))
|
||||||
->setModel(new BaseList('Tasks List', self::MODEL_EXECUTION_LIST, 'tasks', self::MODEL_EXECUTION))
|
->setModel(new BaseList('Tasks List', self::MODEL_EXECUTION_LIST, 'tasks', self::MODEL_EXECUTION))
|
||||||
->setModel(new BaseList('Platforms List', self::MODEL_EXECUTION_LIST, 'platforms', self::MODEL_EXECUTION))
|
->setModel(new BaseList('Platforms List', self::MODEL_EXECUTION_LIST, 'platforms', self::MODEL_EXECUTION))
|
||||||
->setModel(new BaseList('Domains List', self::MODEL_EXECUTION_LIST, 'domains', self::MODEL_EXECUTION))
|
->setModel(new BaseList('Domains List', self::MODEL_EXECUTION_LIST, 'domains', self::MODEL_EXECUTION))
|
||||||
|
@ -116,6 +117,7 @@ class Response extends SwooleResponse
|
||||||
->setModel(new Tag())
|
->setModel(new Tag())
|
||||||
->setModel(new Execution())
|
->setModel(new Execution())
|
||||||
->setModel(new Webhook())
|
->setModel(new Webhook())
|
||||||
|
->setModel(new Key())
|
||||||
;
|
;
|
||||||
|
|
||||||
parent::__construct($response);
|
parent::__construct($response);
|
||||||
|
|
57
src/Appwrite/Utopia/Response/Model/Key.php
Normal file
57
src/Appwrite/Utopia/Response/Model/Key.php
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Appwrite\Utopia\Response\Model;
|
||||||
|
|
||||||
|
use Appwrite\Utopia\Response;
|
||||||
|
use Appwrite\Utopia\Response\Model;
|
||||||
|
|
||||||
|
class Key extends Model
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->addRule('$id', [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => 'Key ID.',
|
||||||
|
'example' => '5e5ea5c16897e',
|
||||||
|
])
|
||||||
|
->addRule('name', [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => 'Key name.',
|
||||||
|
'example' => 'My API Key',
|
||||||
|
])
|
||||||
|
->addRule('scopes', [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => 'Allowed permission scopes.',
|
||||||
|
'default' => [],
|
||||||
|
'example' => ['users.read', 'documents.write'],
|
||||||
|
'array' => true,
|
||||||
|
])
|
||||||
|
->addRule('secret', [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => 'Secret key.',
|
||||||
|
'example' => '919c2d18fb5d4...a2ae413da83346ad2',
|
||||||
|
])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName():string
|
||||||
|
{
|
||||||
|
return 'Key';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Collection
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getType():string
|
||||||
|
{
|
||||||
|
return Response::MODEL_KEY;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue