mirror of
https://github.com/flextype/flextype.git
synced 2025-08-28 23:40:41 +02:00
feat(core): add Files API basic files #428
This commit is contained in:
45
src/flextype/core/Files/Files.php
Normal file
45
src/flextype/core/Files/Files.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (http://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use function md5;
|
||||
|
||||
class Files
|
||||
{
|
||||
/**
|
||||
* Flextype Dependency Container
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private $flextype;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($flextype)
|
||||
{
|
||||
$this->flextype = $flextype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create file
|
||||
*
|
||||
* @param string $data Unique identifier of the entry(entries).
|
||||
* @return array The entry array data.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function create(string $data) : array
|
||||
{
|
||||
|
||||
}
|
||||
}
|
29
src/flextype/endpoints/delivery/files.php
Normal file
29
src/flextype/endpoints/delivery/files.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (http://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use function array_replace_recursive;
|
||||
|
||||
/**
|
||||
* API sys messages
|
||||
*/
|
||||
$api_sys_messages['AccessTokenInvalid'] = ['sys' => ['type' => 'Error', 'id' => 'AccessTokenInvalid'], 'message' => 'The access token you sent could not be found or is invalid.'];
|
||||
$api_sys_messages['NotFound'] = ['sys' => ['type' => 'Error', 'id' => 'NotFound'], 'message' => 'The resource could not be found.'];
|
||||
|
||||
/**
|
||||
* Validate delivery files token
|
||||
*/
|
||||
function validate_delivery_files_token($token) : bool
|
||||
{
|
||||
return Filesystem::has(PATH['project'] . '/tokens/delivery/files/' . $token . '/token.yaml');
|
||||
}
|
Reference in New Issue
Block a user