Required role: | User |
GET | /sessions/{sessionId}/transcript |
---|
<?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 ChatTranscriptMessage implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $date=null,
/** @var string|null */
public ?string $from=null,
/** @var string|null */
public ?string $body=null,
/** @var string|null */
public ?string $mediaUri=null,
/** @var string|null */
public ?string $mediaContentType=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['date'])) $this->date = $o['date'];
if (isset($o['from'])) $this->from = $o['from'];
if (isset($o['body'])) $this->body = $o['body'];
if (isset($o['mediaUri'])) $this->mediaUri = $o['mediaUri'];
if (isset($o['mediaContentType'])) $this->mediaContentType = $o['mediaContentType'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->date)) $o['date'] = $this->date;
if (isset($this->from)) $o['from'] = $this->from;
if (isset($this->body)) $o['body'] = $this->body;
if (isset($this->mediaUri)) $o['mediaUri'] = $this->mediaUri;
if (isset($this->mediaContentType)) $o['mediaContentType'] = $this->mediaContentType;
return empty($o) ? new class(){} : $o;
}
}
class GetChatTranscriptResponse implements JsonSerializable
{
public function __construct(
/** @var array<ChatTranscriptMessage>|null */
public ?array $messages=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['messages'])) $this->messages = JsonConverters::fromArray('ChatTranscriptMessage', $o['messages']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->messages)) $o['messages'] = JsonConverters::toArray('ChatTranscriptMessage', $this->messages);
return empty($o) ? new class(){} : $o;
}
}
/** @description Gets the specified transcript */
// @Api(Description="Gets the specified transcript")
class GetChatTranscript implements IGet, JsonSerializable
{
public function __construct(
/** @description the session whose transcript you want to get */
// @ApiMember(Description="the session whose transcript you want to get")
/** @var string|null */
public ?string $sessionId=null,
/** @description Include previous messages from this chat party */
// @ApiMember(Description="Include previous messages from this chat party")
/** @var bool|null */
public ?bool $includeHistorical=null,
/** @description How far back to include in historical messages. Max 6 months in past */
// @ApiMember(Description="How far back to include in historical messages. Max 6 months in past")
/** @var string|null */
public ?string $historicalCutOffDate=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['sessionId'])) $this->sessionId = $o['sessionId'];
if (isset($o['includeHistorical'])) $this->includeHistorical = $o['includeHistorical'];
if (isset($o['historicalCutOffDate'])) $this->historicalCutOffDate = $o['historicalCutOffDate'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->sessionId)) $o['sessionId'] = $this->sessionId;
if (isset($this->includeHistorical)) $o['includeHistorical'] = $this->includeHistorical;
if (isset($this->historicalCutOffDate)) $o['historicalCutOffDate'] = $this->historicalCutOffDate;
return empty($o) ? new class(){} : $o;
}
}
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.
GET /sessions/{sessionId}/transcript HTTP/1.1 Host: team.evovoice.io Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { messages: [ { date: String, from: String, body: String, mediaUri: String, mediaContentType: String } ] }