| Requires any of the roles: | Agent, Administrator |
| POST,OPTIONS | /v1/DocumentSearch |
|---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class LineSearchResult implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $LineText=null,
/** @var int */
public int $PageNo=0,
/** @var int */
public int $PageLineNo=0,
/** @var int */
public int $DocLineNo=0,
/** @var float */
public float $BoxTop=0.0,
/** @var float */
public float $BoxLeft=0.0,
/** @var float */
public float $BoxWidth=0.0,
/** @var float */
public float $BoxHeight=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['LineText'])) $this->LineText = $o['LineText'];
if (isset($o['PageNo'])) $this->PageNo = $o['PageNo'];
if (isset($o['PageLineNo'])) $this->PageLineNo = $o['PageLineNo'];
if (isset($o['DocLineNo'])) $this->DocLineNo = $o['DocLineNo'];
if (isset($o['BoxTop'])) $this->BoxTop = $o['BoxTop'];
if (isset($o['BoxLeft'])) $this->BoxLeft = $o['BoxLeft'];
if (isset($o['BoxWidth'])) $this->BoxWidth = $o['BoxWidth'];
if (isset($o['BoxHeight'])) $this->BoxHeight = $o['BoxHeight'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->LineText)) $o['LineText'] = $this->LineText;
if (isset($this->PageNo)) $o['PageNo'] = $this->PageNo;
if (isset($this->PageLineNo)) $o['PageLineNo'] = $this->PageLineNo;
if (isset($this->DocLineNo)) $o['DocLineNo'] = $this->DocLineNo;
if (isset($this->BoxTop)) $o['BoxTop'] = $this->BoxTop;
if (isset($this->BoxLeft)) $o['BoxLeft'] = $this->BoxLeft;
if (isset($this->BoxWidth)) $o['BoxWidth'] = $this->BoxWidth;
if (isset($this->BoxHeight)) $o['BoxHeight'] = $this->BoxHeight;
return empty($o) ? new class(){} : $o;
}
}
class DocumentSearchResult implements JsonSerializable
{
public function __construct(
/** @var string */
public string $AttachmentId='',
/** @var DateTime */
public DateTime $DateAdded=new DateTime(),
/** @var string|null */
public ?string $AttachmentName=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $DocumentType=null,
/** @var string|null */
public ?string $DocumentGroup=null,
/** @var string|null */
public ?string $DropboxTableName=null,
/** @var int */
public int $DropboxRecordId=0,
/** @var string|null */
public ?string $AttachmentTableName=null,
/** @var string|null */
public ?string $AttachmentFieldName=null,
/** @var int */
public int $AttachmentRecordId=0,
/** @var string|null */
public ?string $FilePath=null,
/** @var string|null */
public ?string $OCRSource=null,
/** @var string|null */
public ?string $OCRResult=null,
/** @var array<LineSearchResult>|null */
public ?array $Lines=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AttachmentId'])) $this->AttachmentId = $o['AttachmentId'];
if (isset($o['DateAdded'])) $this->DateAdded = JsonConverters::from('DateTime', $o['DateAdded']);
if (isset($o['AttachmentName'])) $this->AttachmentName = $o['AttachmentName'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['DocumentType'])) $this->DocumentType = $o['DocumentType'];
if (isset($o['DocumentGroup'])) $this->DocumentGroup = $o['DocumentGroup'];
if (isset($o['DropboxTableName'])) $this->DropboxTableName = $o['DropboxTableName'];
if (isset($o['DropboxRecordId'])) $this->DropboxRecordId = $o['DropboxRecordId'];
if (isset($o['AttachmentTableName'])) $this->AttachmentTableName = $o['AttachmentTableName'];
if (isset($o['AttachmentFieldName'])) $this->AttachmentFieldName = $o['AttachmentFieldName'];
if (isset($o['AttachmentRecordId'])) $this->AttachmentRecordId = $o['AttachmentRecordId'];
if (isset($o['FilePath'])) $this->FilePath = $o['FilePath'];
if (isset($o['OCRSource'])) $this->OCRSource = $o['OCRSource'];
if (isset($o['OCRResult'])) $this->OCRResult = $o['OCRResult'];
if (isset($o['Lines'])) $this->Lines = JsonConverters::fromArray('LineSearchResult', $o['Lines']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AttachmentId)) $o['AttachmentId'] = $this->AttachmentId;
if (isset($this->DateAdded)) $o['DateAdded'] = JsonConverters::to('DateTime', $this->DateAdded);
if (isset($this->AttachmentName)) $o['AttachmentName'] = $this->AttachmentName;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->DocumentType)) $o['DocumentType'] = $this->DocumentType;
if (isset($this->DocumentGroup)) $o['DocumentGroup'] = $this->DocumentGroup;
if (isset($this->DropboxTableName)) $o['DropboxTableName'] = $this->DropboxTableName;
if (isset($this->DropboxRecordId)) $o['DropboxRecordId'] = $this->DropboxRecordId;
if (isset($this->AttachmentTableName)) $o['AttachmentTableName'] = $this->AttachmentTableName;
if (isset($this->AttachmentFieldName)) $o['AttachmentFieldName'] = $this->AttachmentFieldName;
if (isset($this->AttachmentRecordId)) $o['AttachmentRecordId'] = $this->AttachmentRecordId;
if (isset($this->FilePath)) $o['FilePath'] = $this->FilePath;
if (isset($this->OCRSource)) $o['OCRSource'] = $this->OCRSource;
if (isset($this->OCRResult)) $o['OCRResult'] = $this->OCRResult;
if (isset($this->Lines)) $o['Lines'] = JsonConverters::toArray('LineSearchResult', $this->Lines);
return empty($o) ? new class(){} : $o;
}
}
class DocumentSearchResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $DocumentSearchCount=0,
/** @var array<DocumentSearchResult>|null */
public ?array $DocumentSearchResults=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DocumentSearchCount'])) $this->DocumentSearchCount = $o['DocumentSearchCount'];
if (isset($o['DocumentSearchResults'])) $this->DocumentSearchResults = JsonConverters::fromArray('DocumentSearchResult', $o['DocumentSearchResults']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DocumentSearchCount)) $o['DocumentSearchCount'] = $this->DocumentSearchCount;
if (isset($this->DocumentSearchResults)) $o['DocumentSearchResults'] = JsonConverters::toArray('DocumentSearchResult', $this->DocumentSearchResults);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
enum DocumentSearchMode : int
{
case Exact = 1;
case Contains = 2;
case StartsWith = 3;
case EndsWith = 4;
}
enum DocumentTermMode : int
{
case All = 1;
case Any = 2;
}
class DocumentSearchRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $searchTerms=null,
/** @var DocumentSearchMode|null */
public ?DocumentSearchMode $searchMode=null,
/** @var DocumentTermMode|null */
public ?DocumentTermMode $termMode=null,
/** @var string */
public string $userId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['searchTerms'])) $this->searchTerms = $o['searchTerms'];
if (isset($o['searchMode'])) $this->searchMode = JsonConverters::from('DocumentSearchMode', $o['searchMode']);
if (isset($o['termMode'])) $this->termMode = JsonConverters::from('DocumentTermMode', $o['termMode']);
if (isset($o['userId'])) $this->userId = $o['userId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->searchTerms)) $o['searchTerms'] = $this->searchTerms;
if (isset($this->searchMode)) $o['searchMode'] = JsonConverters::to('DocumentSearchMode', $this->searchMode);
if (isset($this->termMode)) $o['termMode'] = JsonConverters::to('DocumentTermMode', $this->termMode);
if (isset($this->userId)) $o['userId'] = $this->userId;
return empty($o) ? new class(){} : $o;
}
}
PHP DocumentSearchRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/DocumentSearch HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
searchTerms: String,
searchMode: Exact,
termMode: All,
userId: 00000000000000000000000000000000
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
DocumentSearchCount: 0,
DocumentSearchResults:
[
{
AttachmentId: 00000000000000000000000000000000,
DateAdded: 0001-01-01,
AttachmentName: String,
Description: String,
DocumentType: String,
DocumentGroup: String,
DropboxTableName: String,
DropboxRecordId: 0,
AttachmentTableName: String,
AttachmentFieldName: String,
AttachmentRecordId: 0,
FilePath: String,
OCRSource: String,
OCRResult: String,
Lines:
[
{
LineText: String,
PageNo: 0,
PageLineNo: 0,
DocLineNo: 0,
BoxTop: 0,
BoxLeft: 0,
BoxWidth: 0,
BoxHeight: 0
}
]
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}