1
0
Fork 0
mirror of synced 2024-09-22 04:21:21 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/BaseList.php

69 lines
1.4 KiB
PHP
Raw Normal View History

2020-06-24 17:14:42 +12:00
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class BaseList extends Model
2020-06-24 17:14:42 +12:00
{
/**
* @var string
*/
protected $name = '';
/**
* @var string
*/
protected $type = '';
/**
* @param string $name
* @param string $type
* @param string $key
* @param string $model
* @param bool $paging
* @param bool $public
*/
public function __construct(string $name, string $type, string $key, string $model, bool $paging = true, bool $public = true)
2020-06-24 17:14:42 +12:00
{
$this->name = $name;
$this->type = $type;
$this->public = $public;
2020-10-30 11:44:01 +13:00
if ($paging) {
$this->addRule('sum', [
2020-11-08 11:14:48 +13:00
'type' => self::TYPE_INTEGER,
2020-06-24 17:14:42 +12:00
'description' => 'Total sum of items in the list.',
2020-11-14 09:38:47 +13:00
'default' => 0,
'example' => 5,
]);
}
$this->addRule($key, [
'type' => $model,
'description' => 'List of '.$key.'.',
2020-11-14 09:38:47 +13:00
'default' => [],
'array' => true,
]);
2020-06-24 17:14:42 +12:00
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return $this->name;
2020-06-24 17:14:42 +12:00
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return $this->type;
2020-06-24 17:14:42 +12:00
}
}