| POST | /v1/c/thread/{Kind}/{RefId} |
|---|
<?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 JobThreadMessageView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Party=null,
/** @var bool|null */
public ?bool $Mine=null,
/** @var string|null */
public ?string $Who=null,
/** @var string|null */
public ?string $Body=null,
/** @var bool|null */
public ?bool $ViaVoice=null,
/** @var bool|null */
public ?bool $IsStatusChip=null,
/** @var string|null */
public ?string $ChipKey=null,
/** @var DateTime */
public DateTime $SentUtc=new DateTime(),
/** @var string|null */
public ?string $SentLocal=null,
/** @var bool|null */
public ?bool $Seen=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Party'])) $this->Party = $o['Party'];
if (isset($o['Mine'])) $this->Mine = $o['Mine'];
if (isset($o['Who'])) $this->Who = $o['Who'];
if (isset($o['Body'])) $this->Body = $o['Body'];
if (isset($o['ViaVoice'])) $this->ViaVoice = $o['ViaVoice'];
if (isset($o['IsStatusChip'])) $this->IsStatusChip = $o['IsStatusChip'];
if (isset($o['ChipKey'])) $this->ChipKey = $o['ChipKey'];
if (isset($o['SentUtc'])) $this->SentUtc = JsonConverters::from('DateTime', $o['SentUtc']);
if (isset($o['SentLocal'])) $this->SentLocal = $o['SentLocal'];
if (isset($o['Seen'])) $this->Seen = $o['Seen'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Party)) $o['Party'] = $this->Party;
if (isset($this->Mine)) $o['Mine'] = $this->Mine;
if (isset($this->Who)) $o['Who'] = $this->Who;
if (isset($this->Body)) $o['Body'] = $this->Body;
if (isset($this->ViaVoice)) $o['ViaVoice'] = $this->ViaVoice;
if (isset($this->IsStatusChip)) $o['IsStatusChip'] = $this->IsStatusChip;
if (isset($this->ChipKey)) $o['ChipKey'] = $this->ChipKey;
if (isset($this->SentUtc)) $o['SentUtc'] = JsonConverters::to('DateTime', $this->SentUtc);
if (isset($this->SentLocal)) $o['SentLocal'] = $this->SentLocal;
if (isset($this->Seen)) $o['Seen'] = $this->Seen;
return empty($o) ? new class(){} : $o;
}
}
class JobThreadView implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Kind=null,
/** @var int */
public int $RefId=0,
/** @var string|null */
public ?string $RefCode=null,
/** @var int */
public int $WorkerContactId=0,
/** @var string|null */
public ?string $Who=null,
/** @var bool|null */
public ?bool $Closed=null,
/** @var string|null */
public ?string $ClosesLocal=null,
/** @var int */
public int $Unread=0,
/** @var string|null */
public ?string $Note=null,
/** @var array<string>|null */
public ?array $QuickReplies=null,
/** @var array<JobThreadMessageView>|null */
public ?array $Messages=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['RefId'])) $this->RefId = $o['RefId'];
if (isset($o['RefCode'])) $this->RefCode = $o['RefCode'];
if (isset($o['WorkerContactId'])) $this->WorkerContactId = $o['WorkerContactId'];
if (isset($o['Who'])) $this->Who = $o['Who'];
if (isset($o['Closed'])) $this->Closed = $o['Closed'];
if (isset($o['ClosesLocal'])) $this->ClosesLocal = $o['ClosesLocal'];
if (isset($o['Unread'])) $this->Unread = $o['Unread'];
if (isset($o['Note'])) $this->Note = $o['Note'];
if (isset($o['QuickReplies'])) $this->QuickReplies = JsonConverters::fromArray('string', $o['QuickReplies']);
if (isset($o['Messages'])) $this->Messages = JsonConverters::fromArray('JobThreadMessageView', $o['Messages']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->RefId)) $o['RefId'] = $this->RefId;
if (isset($this->RefCode)) $o['RefCode'] = $this->RefCode;
if (isset($this->WorkerContactId)) $o['WorkerContactId'] = $this->WorkerContactId;
if (isset($this->Who)) $o['Who'] = $this->Who;
if (isset($this->Closed)) $o['Closed'] = $this->Closed;
if (isset($this->ClosesLocal)) $o['ClosesLocal'] = $this->ClosesLocal;
if (isset($this->Unread)) $o['Unread'] = $this->Unread;
if (isset($this->Note)) $o['Note'] = $this->Note;
if (isset($this->QuickReplies)) $o['QuickReplies'] = JsonConverters::toArray('string', $this->QuickReplies);
if (isset($this->Messages)) $o['Messages'] = JsonConverters::toArray('JobThreadMessageView', $this->Messages);
return empty($o) ? new class(){} : $o;
}
}
class ProblemReasonView implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Key=null,
/** @var string|null */
public ?string $Label=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['Label'])) $this->Label = $o['Label'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->Label)) $o['Label'] = $this->Label;
return empty($o) ? new class(){} : $o;
}
}
class CustomerThreadResponse implements JsonSerializable
{
public function __construct(
/** @var array<JobThreadView>|null */
public ?array $Threads=null,
/** @var array<ProblemReasonView>|null */
public ?array $ProblemReasons=null,
/** @var string|null */
public ?string $Message=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Threads'])) $this->Threads = JsonConverters::fromArray('JobThreadView', $o['Threads']);
if (isset($o['ProblemReasons'])) $this->ProblemReasons = JsonConverters::fromArray('ProblemReasonView', $o['ProblemReasons']);
if (isset($o['Message'])) $this->Message = $o['Message'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Threads)) $o['Threads'] = JsonConverters::toArray('JobThreadView', $this->Threads);
if (isset($this->ProblemReasons)) $o['ProblemReasons'] = JsonConverters::toArray('ProblemReasonView', $this->ProblemReasons);
if (isset($this->Message)) $o['Message'] = $this->Message;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class CustomerThreadPostRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Kind=null,
/** @var int */
public int $RefId=0,
/** @var int */
public int $WorkerContactId=0,
/** @var string|null */
public ?string $Body=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Kind'])) $this->Kind = $o['Kind'];
if (isset($o['RefId'])) $this->RefId = $o['RefId'];
if (isset($o['WorkerContactId'])) $this->WorkerContactId = $o['WorkerContactId'];
if (isset($o['Body'])) $this->Body = $o['Body'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Kind)) $o['Kind'] = $this->Kind;
if (isset($this->RefId)) $o['RefId'] = $this->RefId;
if (isset($this->WorkerContactId)) $o['WorkerContactId'] = $this->WorkerContactId;
if (isset($this->Body)) $o['Body'] = $this->Body;
return empty($o) ? new class(){} : $o;
}
}
PHP CustomerThreadPostRequest DTOs
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/c/thread/{Kind}/{RefId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"Kind":"String","RefId":0,"WorkerContactId":0,"Body":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"Threads":[{"Id":0,"Kind":"String","RefId":0,"RefCode":"String","WorkerContactId":0,"Who":"String","Closed":false,"ClosesLocal":"String","Unread":0,"Note":"String","QuickReplies":["String"],"Messages":[{"Id":0,"Party":"String","Mine":false,"Who":"String","Body":"String","ViaVoice":false,"IsStatusChip":false,"ChipKey":"String","SentUtc":"0001-01-01T00:00:00.0000000","SentLocal":"String","Seen":false}]}],"ProblemReasons":[{"Key":"String","Label":"String"}],"Message":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}