1
0
Fork 0
mirror of synced 2024-09-12 07:36:01 +12:00

fix lint issuesl

This commit is contained in:
prateek banga 2023-08-07 21:01:25 +05:30
parent 3e70a19e4f
commit d7f806e671
6 changed files with 118 additions and 118 deletions

View file

@ -309,7 +309,7 @@ class Response extends SwooleResponse
->setModel(new BaseList('Message list', self::MODEL_MESSAGE_LIST, 'messages', self::MODEL_MESSAGE)) ->setModel(new BaseList('Message list', self::MODEL_MESSAGE_LIST, 'messages', self::MODEL_MESSAGE))
->setModel(new BaseList('Topic list', self::MODEL_TOPIC_LIST, 'topics', self::MODEL_TOPIC)) ->setModel(new BaseList('Topic list', self::MODEL_TOPIC_LIST, 'topics', self::MODEL_TOPIC))
->setModel(new BaseList('Subscriber list', self::MODEL_SUBSCRIBER_LIST, 'subscribers', self::MODEL_SUBSCRIBER)) ->setModel(new BaseList('Subscriber list', self::MODEL_SUBSCRIBER_LIST, 'subscribers', self::MODEL_SUBSCRIBER))
->setModel(new BaseList('Target list', self::MODEL_TARGET_LIST, 'targets', self::MODEL_TARGET)) ->setModel(new BaseList('Target list', self::MODEL_TARGET_LIST, 'targets', self::MODEL_TARGET))
// Entities // Entities
->setModel(new Database()) ->setModel(new Database())
->setModel(new Collection()) ->setModel(new Collection())

View file

@ -11,87 +11,87 @@ class Message extends Model
/** /**
* @var bool * @var bool
*/ */
protected bool $public = false; protected bool $public = false;
public function __construct() public function __construct()
{ {
$this $this
->addRule('$id', [ ->addRule('$id', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Message ID.', 'description' => 'Message ID.',
'default' => '', 'default' => '',
'example' => '5e5ea5c16897e', 'example' => '5e5ea5c16897e',
]) ])
->addRule('providerId', [ ->addRule('providerId', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Provider Id for the message.', 'description' => 'Provider Id for the message.',
'default' => '', 'default' => '',
'example' => '5e5ea5c16897e', 'example' => '5e5ea5c16897e',
]) ])
->addRule('data', [ ->addRule('data', [
'type' => self::TYPE_JSON, 'type' => self::TYPE_JSON,
'description' => 'Message Data.', 'description' => 'Message Data.',
'default' => '', 'default' => '',
'required' => false, 'required' => false,
'example' => '', 'example' => '',
]) ])
->addRule('to', [ ->addRule('to', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Recipient of message.', 'description' => 'Recipient of message.',
'default' => '', 'default' => '',
'example' => ['user-1'], 'example' => ['user-1'],
]) ])
->addRule('deliveryTime', [ ->addRule('deliveryTime', [
'type' => self::TYPE_DATETIME, 'type' => self::TYPE_DATETIME,
'description' => 'Recipient of message.', 'description' => 'Recipient of message.',
'required' => false, 'required' => false,
'default' => DateTime::now(), 'default' => DateTime::now(),
'example' => DateTime::now(), 'example' => DateTime::now(),
]) ])
->addRule('deliveryError', [ ->addRule('deliveryError', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Delivery error if any.', 'description' => 'Delivery error if any.',
'required' => false, 'required' => false,
'default' => '', 'default' => '',
'example' => 'Provider not valid.', 'example' => 'Provider not valid.',
]) ])
->addRule('deliveredTo', [ ->addRule('deliveredTo', [
'type' => self::TYPE_INTEGER, 'type' => self::TYPE_INTEGER,
'description' => 'Number of recipients the message was delivered to.', 'description' => 'Number of recipients the message was delivered to.',
'default' => '', 'default' => '',
'example' => 1, 'example' => 1,
]) ])
->addRule('delivered', [ ->addRule('delivered', [
'type' => self::TYPE_BOOLEAN, 'type' => self::TYPE_BOOLEAN,
'description' => 'Status of delivery.', 'description' => 'Status of delivery.',
'default' => '', 'default' => '',
'example' => true, 'example' => true,
]) ])
->addRule('search', [ ->addRule('search', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Field that can be used for searching message.', 'description' => 'Field that can be used for searching message.',
'default' => '', 'default' => '',
'example' => 'Hello everyone', 'example' => 'Hello everyone',
]); ]);
} }
/** /**
* Get Name * Get Name
* *
* @return string * @return string
*/ */
public function getName(): string public function getName(): string
{ {
return 'Message'; return 'Message';
} }
/** /**
* Get Type * Get Type
* *
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
{ {
return Response::MODEL_MESSAGE; return Response::MODEL_MESSAGE;
} }
} }

View file

@ -10,54 +10,54 @@ class Provider extends Model
/** /**
* @var bool * @var bool
*/ */
protected bool $public = false; protected bool $public = false;
public function __construct() public function __construct()
{ {
$this $this
->addRule('$id', [ ->addRule('$id', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Provider ID.', 'description' => 'Provider ID.',
'default' => '', 'default' => '',
'example' => '5e5ea5c16897e', 'example' => '5e5ea5c16897e',
]) ])
->addRule('name', [ ->addRule('name', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'The user-given name for the provider instance.', 'description' => 'The user-given name for the provider instance.',
'default' => '', 'default' => '',
'example' => 'Mailgun', 'example' => 'Mailgun',
]) ])
->addRule('provider', [ ->addRule('provider', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Provider name setup in Utopia.', 'description' => 'Provider name setup in Utopia.',
'default' => '', 'default' => '',
'example' => 'mailgun', 'example' => 'mailgun',
]) ])
->addRule('type', [ ->addRule('type', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Type of provider.', 'description' => 'Type of provider.',
'default' => '', 'default' => '',
'example' => 'sms', 'example' => 'sms',
]); ]);
} }
/** /**
* Get Name * Get Name
* *
* @return string * @return string
*/ */
public function getName(): string public function getName(): string
{ {
return 'Provider'; return 'Provider';
} }
/** /**
* Get Type * Get Type
* *
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
{ {
return Response::MODEL_PROVIDER; return Response::MODEL_PROVIDER;
} }
} }

View file

@ -10,54 +10,54 @@ class Subscriber extends Model
/** /**
* @var bool * @var bool
*/ */
protected bool $public = false; protected bool $public = false;
public function __construct() public function __construct()
{ {
$this $this
->addRule('$id', [ ->addRule('$id', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Subscriber ID.', 'description' => 'Subscriber ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('userId', [ ->addRule('userId', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'User ID.', 'description' => 'User ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('targetId', [ ->addRule('targetId', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Target ID.', 'description' => 'Target ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('topicId', [ ->addRule('topicId', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Topic ID.', 'description' => 'Topic ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]); ]);
} }
/** /**
* Get Name * Get Name
* *
* @return string * @return string
*/ */
public function getName(): string public function getName(): string
{ {
return 'Subscriber'; return 'Subscriber';
} }
/** /**
* Get Type * Get Type
* *
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
{ {
return Response::MODEL_SUBSCRIBER; return Response::MODEL_SUBSCRIBER;
} }
} }

View file

@ -10,61 +10,61 @@ class Target extends Model
/** /**
* @var bool * @var bool
*/ */
protected bool $public = false; protected bool $public = false;
public function __construct() public function __construct()
{ {
$this $this
->addRule('$id', [ ->addRule('$id', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Target ID.', 'description' => 'Target ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('userId', [ ->addRule('userId', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'User ID.', 'description' => 'User ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('providerId', [ ->addRule('providerId', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Provider ID.', 'description' => 'Provider ID.',
'required' => false, 'required' => false,
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('providerType', [ ->addRule('providerType', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'The type of provider supported by this target.', 'description' => 'The type of provider supported by this target.',
'default' => '', 'default' => '',
'example' => 'sms', 'example' => 'sms',
]) ])
->addRule('identifier', [ ->addRule('identifier', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'The target identifier.', 'description' => 'The target identifier.',
'default' => '', 'default' => '',
'example' => 'token', 'example' => 'token',
]); ]);
} }
/** /**
* Get Name * Get Name
* *
* @return string * @return string
*/ */
public function getName(): string public function getName(): string
{ {
return 'Target'; return 'Target';
} }
/** /**
* Get Type * Get Type
* *
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
{ {
return Response::MODEL_TARGET; return Response::MODEL_TARGET;
} }
} }

View file

@ -10,55 +10,55 @@ class Topic extends Model
/** /**
* @var bool * @var bool
*/ */
protected bool $public = false; protected bool $public = false;
public function __construct() public function __construct()
{ {
$this $this
->addRule('$id', [ ->addRule('$id', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Topic ID.', 'description' => 'Topic ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('providerId', [ ->addRule('providerId', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Provider ID.', 'description' => 'Provider ID.',
'default' => '', 'default' => '',
'example' => '259125845563242502', 'example' => '259125845563242502',
]) ])
->addRule('name', [ ->addRule('name', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'The name of the topic.', 'description' => 'The name of the topic.',
'default' => '', 'default' => '',
'example' => 'events', 'example' => 'events',
]) ])
->addRule('description', [ ->addRule('description', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'Description of the topic.', 'description' => 'Description of the topic.',
'default' => '', 'default' => '',
'required' => false, 'required' => false,
'example' => 'All events related messages will be sent to this topic.', 'example' => 'All events related messages will be sent to this topic.',
]); ]);
} }
/** /**
* Get Name * Get Name
* *
* @return string * @return string
*/ */
public function getName(): string public function getName(): string
{ {
return 'Topic'; return 'Topic';
} }
/** /**
* Get Type * Get Type
* *
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
{ {
return Response::MODEL_TOPIC; return Response::MODEL_TOPIC;
} }
} }