| Requires any of the roles: | Agent, Administrator |
| GET | /v1/Ticket/{TicketId} |
|---|
<?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 Ticket implements JsonSerializable
{
public function __construct(
/** @var int */
public int $TicketId=0,
/** @var DateTime */
public DateTime $CreatedDate=new DateTime(),
/** @var string */
public string $CreatedBy='',
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Resolution=null,
/** @var bool|null */
public ?bool $IsClosed=null,
/** @var bool|null */
public ?bool $IsFollowup=null,
/** @var int */
public int $TicketTypeId=0,
/** @var DateTime */
public DateTime $ModifiedDate=new DateTime(),
/** @var string|null */
public ?string $ModifiedBy=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TicketId'])) $this->TicketId = $o['TicketId'];
if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Resolution'])) $this->Resolution = $o['Resolution'];
if (isset($o['IsClosed'])) $this->IsClosed = $o['IsClosed'];
if (isset($o['IsFollowup'])) $this->IsFollowup = $o['IsFollowup'];
if (isset($o['TicketTypeId'])) $this->TicketTypeId = $o['TicketTypeId'];
if (isset($o['ModifiedDate'])) $this->ModifiedDate = JsonConverters::from('DateTime', $o['ModifiedDate']);
if (isset($o['ModifiedBy'])) $this->ModifiedBy = $o['ModifiedBy'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TicketId)) $o['TicketId'] = $this->TicketId;
if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Resolution)) $o['Resolution'] = $this->Resolution;
if (isset($this->IsClosed)) $o['IsClosed'] = $this->IsClosed;
if (isset($this->IsFollowup)) $o['IsFollowup'] = $this->IsFollowup;
if (isset($this->TicketTypeId)) $o['TicketTypeId'] = $this->TicketTypeId;
if (isset($this->ModifiedDate)) $o['ModifiedDate'] = JsonConverters::to('DateTime', $this->ModifiedDate);
if (isset($this->ModifiedBy)) $o['ModifiedBy'] = $this->ModifiedBy;
return empty($o) ? new class(){} : $o;
}
}
class TicketExtended extends Ticket implements JsonSerializable
{
/**
* @param int $TicketId
* @param DateTime $CreatedDate
* @param string $CreatedBy
* @param string|null $Description
* @param string|null $Resolution
* @param bool|null $IsClosed
* @param bool|null $IsFollowup
* @param int $TicketTypeId
* @param DateTime $ModifiedDate
* @param string|null $ModifiedBy
*/
public function __construct(
int $TicketId=0,
DateTime $CreatedDate=new DateTime(),
string $CreatedBy='',
?string $Description=null,
?string $Resolution=null,
?bool $IsClosed=null,
?bool $IsFollowup=null,
int $TicketTypeId=0,
DateTime $ModifiedDate=new DateTime(),
?string $ModifiedBy=null,
/** @var string|null */
public ?string $AgentName=null,
/** @var string|null */
public ?string $TicketType=null,
/** @var bool|null */
public ?bool $AgentHasRead=null,
/** @var bool|null */
public ?bool $AdminHasRead=null
) {
parent::__construct($TicketId,$CreatedDate,$CreatedBy,$Description,$Resolution,$IsClosed,$IsFollowup,$TicketTypeId,$ModifiedDate,$ModifiedBy);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['AgentName'])) $this->AgentName = $o['AgentName'];
if (isset($o['TicketType'])) $this->TicketType = $o['TicketType'];
if (isset($o['AgentHasRead'])) $this->AgentHasRead = $o['AgentHasRead'];
if (isset($o['AdminHasRead'])) $this->AdminHasRead = $o['AdminHasRead'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->AgentName)) $o['AgentName'] = $this->AgentName;
if (isset($this->TicketType)) $o['TicketType'] = $this->TicketType;
if (isset($this->AgentHasRead)) $o['AgentHasRead'] = $this->AgentHasRead;
if (isset($this->AdminHasRead)) $o['AdminHasRead'] = $this->AdminHasRead;
return empty($o) ? new class(){} : $o;
}
}
class SingleTicketResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var TicketExtended|null */
public ?TicketExtended $Ticket=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Ticket'])) $this->Ticket = JsonConverters::from('TicketExtended', $o['Ticket']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Ticket)) $o['Ticket'] = JsonConverters::to('TicketExtended', $this->Ticket);
return empty($o) ? new class(){} : $o;
}
}
class SingleTicketRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $TicketId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TicketId'])) $this->TicketId = $o['TicketId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TicketId)) $o['TicketId'] = $this->TicketId;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/Ticket/{TicketId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Ticket":{"AgentName":"String","TicketType":"String","AgentHasRead":false,"AdminHasRead":false,"TicketId":0,"CreatedDate":"0001-01-01T00:00:00.0000000","CreatedBy":"00000000000000000000000000000000","Description":"String","Resolution":"String","IsClosed":false,"IsFollowup":false,"TicketTypeId":0,"ModifiedDate":"0001-01-01T00:00:00.0000000","ModifiedBy":"String"}}