| Requires any of the roles: | Worker, Agent, Administrator |
| GET,POST,PUT,DELETE,OPTIONS | /v1/AgentHistory |
|---|
<?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 AgentHistory implements JsonSerializable
{
public function __construct(
/** @var int */
public int $AgentHistoryId=0,
/** @var int */
public int $SubAgentId=0,
/** @var int */
public int $EventId=0,
/** @var int */
public int $AgentId=0,
/** @var DateTime */
public DateTime $EventDate=new DateTime(),
/** @var DateTime */
public DateTime $DateCreated=new DateTime(),
/** @var string|null */
public ?string $Note=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AgentHistoryId'])) $this->AgentHistoryId = $o['AgentHistoryId'];
if (isset($o['SubAgentId'])) $this->SubAgentId = $o['SubAgentId'];
if (isset($o['EventId'])) $this->EventId = $o['EventId'];
if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
if (isset($o['EventDate'])) $this->EventDate = JsonConverters::from('DateTime', $o['EventDate']);
if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
if (isset($o['Note'])) $this->Note = $o['Note'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AgentHistoryId)) $o['AgentHistoryId'] = $this->AgentHistoryId;
if (isset($this->SubAgentId)) $o['SubAgentId'] = $this->SubAgentId;
if (isset($this->EventId)) $o['EventId'] = $this->EventId;
if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
if (isset($this->EventDate)) $o['EventDate'] = JsonConverters::to('DateTime', $this->EventDate);
if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
if (isset($this->Note)) $o['Note'] = $this->Note;
return empty($o) ? new class(){} : $o;
}
}
class AgentHistoryResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<AgentHistory>|null */
public ?array $AgentHistory=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['AgentHistory'])) $this->AgentHistory = JsonConverters::fromArray('AgentHistory', $o['AgentHistory']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->AgentHistory)) $o['AgentHistory'] = JsonConverters::toArray('AgentHistory', $this->AgentHistory);
return empty($o) ? new class(){} : $o;
}
}
class AgentHistoryRequest implements JsonSerializable
{
public function __construct(
/** @var array<AgentHistory>|null */
public ?array $AgentHistory=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AgentHistory'])) $this->AgentHistory = JsonConverters::fromArray('AgentHistory', $o['AgentHistory']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AgentHistory)) $o['AgentHistory'] = JsonConverters::toArray('AgentHistory', $this->AgentHistory);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/AgentHistory HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"AgentHistory":[{"AgentHistoryId":0,"SubAgentId":0,"EventId":0,"AgentId":0,"EventDate":"0001-01-01T00:00:00.0000000","DateCreated":"0001-01-01T00:00:00.0000000","Note":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"AgentHistory":[{"AgentHistoryId":0,"SubAgentId":0,"EventId":0,"AgentId":0,"EventDate":"0001-01-01T00:00:00.0000000","DateCreated":"0001-01-01T00:00:00.0000000","Note":"String"}]}