2020-06-05 09:53:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
2020-06-23 15:01:20 +00:00
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
2020-06-05 09:53:06 +00:00
|
|
|
|
2020-06-23 15:01:20 +00:00
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
2020-06-05 09:53:06 +00:00
|
|
|
|
2020-06-23 15:01:20 +00:00
|
|
|
class User extends Model
|
2020-06-05 09:53:06 +00:00
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
2020-06-22 16:25:01 +00:00
|
|
|
->addRule('$id', [
|
|
|
|
|
'type' => 'string',
|
|
|
|
|
'description' => 'User ID.',
|
|
|
|
|
'example' => '5e5ea5c16897e',
|
|
|
|
|
])
|
|
|
|
|
->addRule('name', [
|
|
|
|
|
'type' => 'string',
|
|
|
|
|
'description' => 'User name.',
|
|
|
|
|
'example' => 'John Doe',
|
|
|
|
|
])
|
2020-06-22 19:06:57 +00:00
|
|
|
->addRule('registration', [
|
|
|
|
|
'type' => 'integer',
|
2020-06-24 11:18:33 +00:00
|
|
|
'description' => 'User registration date in Unix timestamp.',
|
2020-06-24 06:53:13 +00:00
|
|
|
'example' => 1592981250,
|
2020-06-22 19:06:57 +00:00
|
|
|
])
|
|
|
|
|
->addRule('status', [
|
|
|
|
|
'type' => 'integer',
|
|
|
|
|
'description' => 'User status. 0 for Unavtivated, 1 for active and 2 is blocked.',
|
2020-10-29 13:07:56 +00:00
|
|
|
'example' => 0,
|
2020-06-22 19:06:57 +00:00
|
|
|
])
|
2020-06-22 16:25:01 +00:00
|
|
|
->addRule('email', [
|
|
|
|
|
'type' => 'string',
|
|
|
|
|
'description' => 'User email address.',
|
|
|
|
|
'example' => 'john@appwrite.io',
|
|
|
|
|
])
|
|
|
|
|
->addRule('emailVerification', [
|
|
|
|
|
'type' => 'boolean',
|
|
|
|
|
'description' => 'Email verification status.',
|
|
|
|
|
'default' => false,
|
|
|
|
|
'example' => true,
|
|
|
|
|
])
|
|
|
|
|
->addRule('prefs', [
|
|
|
|
|
'type' => 'json',
|
|
|
|
|
'description' => 'User preferences as a key-value object',
|
|
|
|
|
'default' => new \stdClass,
|
2020-10-29 13:07:56 +00:00
|
|
|
'example' => ['theme' => 'pink', 'timezone' => 'UTC'],
|
2020-06-22 16:25:01 +00:00
|
|
|
])
|
|
|
|
|
->addRule('roles', [
|
|
|
|
|
'type' => 'string',
|
|
|
|
|
'description' => 'User list of roles',
|
|
|
|
|
'default' => [],
|
|
|
|
|
'example' => [],
|
|
|
|
|
'array' => true,
|
|
|
|
|
])
|
2020-06-05 09:53:06 +00:00
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getName():string
|
|
|
|
|
{
|
|
|
|
|
return 'User';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Collection
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2020-06-23 15:01:20 +00:00
|
|
|
public function getType():string
|
2020-06-05 09:53:06 +00:00
|
|
|
{
|
2020-06-23 15:01:20 +00:00
|
|
|
return Response::MODEL_USER;
|
2020-06-05 09:53:06 +00:00
|
|
|
}
|
|
|
|
|
}
|