mirror of
https://github.com/nextcloud/app_api.git
synced 2026-01-13 20:19:21 +00:00
Ref: #204 Changed: * added new table `ex_text_processing_q` and TextProcessing queue in AppAPI * added `reportResult` route, allowing storing results from ExApp provider * API for ExApp TextProcessing provider implementation
61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\AppAPI\Db\TextProcessing;
|
|
|
|
use OCP\AppFramework\Db\Entity;
|
|
|
|
/**
|
|
* Class TextProcessingProviderQueue
|
|
*
|
|
* @package OCA\AppAPI\Db\TextProcessing
|
|
*
|
|
* @method string getResult()
|
|
* @method string getError()
|
|
* @method int getFinished()
|
|
* @method int getCreatedTime()
|
|
* @method void setResult(string $result)
|
|
* @method void setError(string $error)
|
|
* @method void setFinished(int $finished)
|
|
* @method void setCreatedTime(int $createdTime)
|
|
*/
|
|
class TextProcessingProviderQueue extends Entity implements \JsonSerializable {
|
|
protected $result;
|
|
protected $error;
|
|
protected $finished;
|
|
protected $createdTime;
|
|
public function __construct(array $params = []) {
|
|
$this->addType('result', 'string');
|
|
$this->addType('error', 'string');
|
|
$this->addType('finished', 'int');
|
|
$this->addType('createdTime', 'int');
|
|
|
|
if (isset($params['id'])) {
|
|
$this->setId($params['id']);
|
|
}
|
|
if (isset($params['result'])) {
|
|
$this->setResult($params['result']);
|
|
}
|
|
if (isset($params['error'])) {
|
|
$this->setError($params['error']);
|
|
}
|
|
if (isset($params['finished'])) {
|
|
$this->setFinished($params['finished']);
|
|
}
|
|
if (isset($params['created_time'])) {
|
|
$this->setCreatedTime($params['created_time']);
|
|
}
|
|
}
|
|
|
|
public function jsonSerialize(): array {
|
|
return [
|
|
'id' => $this->getId(),
|
|
'result' => $this->getResult(),
|
|
'error' => $this->getError(),
|
|
'finished' => $this->getFinished(),
|
|
'created_time' => $this->getCreatedTime(),
|
|
];
|
|
}
|
|
}
|