All Verbs | /nodes/live-answer/callback |
---|
<?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 LiveAnswerCallbackTranscriptMessage implements JsonSerializable
{
public function __construct(
/** @var DateTime */
public DateTime $date=new DateTime(),
/** @var string|null */
public ?string $role=null,
/** @var string|null */
public ?string $senderName=null,
/** @var string|null */
public ?string $targetName=null,
/** @var string|null */
public ?string $functionName=null,
/** @var string|null */
public ?string $functionArgs=null,
/** @var string|null */
public ?string $content=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['date'])) $this->date = JsonConverters::from('DateTime', $o['date']);
if (isset($o['role'])) $this->role = $o['role'];
if (isset($o['senderName'])) $this->senderName = $o['senderName'];
if (isset($o['targetName'])) $this->targetName = $o['targetName'];
if (isset($o['functionName'])) $this->functionName = $o['functionName'];
if (isset($o['functionArgs'])) $this->functionArgs = $o['functionArgs'];
if (isset($o['content'])) $this->content = $o['content'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->date)) $o['date'] = JsonConverters::to('DateTime', $this->date);
if (isset($this->role)) $o['role'] = $this->role;
if (isset($this->senderName)) $o['senderName'] = $this->senderName;
if (isset($this->targetName)) $o['targetName'] = $this->targetName;
if (isset($this->functionName)) $o['functionName'] = $this->functionName;
if (isset($this->functionArgs)) $o['functionArgs'] = $this->functionArgs;
if (isset($this->content)) $o['content'] = $this->content;
return empty($o) ? new class(){} : $o;
}
}
class LiveAnswerCallbackAttachment implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $fileName=null,
/** @var string|null */
public ?string $contentType=null,
/** @var string|null */
public ?string $uri=null,
/** @var string|null */
public ?string $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['fileName'])) $this->fileName = $o['fileName'];
if (isset($o['contentType'])) $this->contentType = $o['contentType'];
if (isset($o['uri'])) $this->uri = $o['uri'];
if (isset($o['data'])) $this->data = $o['data'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->fileName)) $o['fileName'] = $this->fileName;
if (isset($this->contentType)) $o['contentType'] = $this->contentType;
if (isset($this->uri)) $o['uri'] = $this->uri;
if (isset($this->data)) $o['data'] = $this->data;
return empty($o) ? new class(){} : $o;
}
}
class LiveAnswerCallback implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $sessionId=null,
/** @var string|null */
public ?string $flowId=null,
/** @var string|null */
public ?string $nodeId=null,
/** @var string|null */
public ?string $clientId=null,
/** @var string|null */
public ?string $conversationId=null,
/** @var int */
public int $aiMinutes=0,
/** @var string|null */
public ?string $from=null,
/** @var string|null */
public ?string $to=null,
/** @var array<LiveAnswerCallbackTranscriptMessage>|null */
public ?array $transcript=null,
/** @var DateTime */
public DateTime $startDate=new DateTime(),
/** @var DateTime */
public DateTime $endDate=new DateTime(),
/** @var array<LiveAnswerCallbackAttachment>|null */
public ?array $attachments=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['sessionId'])) $this->sessionId = $o['sessionId'];
if (isset($o['flowId'])) $this->flowId = $o['flowId'];
if (isset($o['nodeId'])) $this->nodeId = $o['nodeId'];
if (isset($o['clientId'])) $this->clientId = $o['clientId'];
if (isset($o['conversationId'])) $this->conversationId = $o['conversationId'];
if (isset($o['aiMinutes'])) $this->aiMinutes = $o['aiMinutes'];
if (isset($o['from'])) $this->from = $o['from'];
if (isset($o['to'])) $this->to = $o['to'];
if (isset($o['transcript'])) $this->transcript = JsonConverters::fromArray('LiveAnswerCallbackTranscriptMessage', $o['transcript']);
if (isset($o['startDate'])) $this->startDate = JsonConverters::from('DateTime', $o['startDate']);
if (isset($o['endDate'])) $this->endDate = JsonConverters::from('DateTime', $o['endDate']);
if (isset($o['attachments'])) $this->attachments = JsonConverters::fromArray('LiveAnswerCallbackAttachment', $o['attachments']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->sessionId)) $o['sessionId'] = $this->sessionId;
if (isset($this->flowId)) $o['flowId'] = $this->flowId;
if (isset($this->nodeId)) $o['nodeId'] = $this->nodeId;
if (isset($this->clientId)) $o['clientId'] = $this->clientId;
if (isset($this->conversationId)) $o['conversationId'] = $this->conversationId;
if (isset($this->aiMinutes)) $o['aiMinutes'] = $this->aiMinutes;
if (isset($this->from)) $o['from'] = $this->from;
if (isset($this->to)) $o['to'] = $this->to;
if (isset($this->transcript)) $o['transcript'] = JsonConverters::toArray('LiveAnswerCallbackTranscriptMessage', $this->transcript);
if (isset($this->startDate)) $o['startDate'] = JsonConverters::to('DateTime', $this->startDate);
if (isset($this->endDate)) $o['endDate'] = JsonConverters::to('DateTime', $this->endDate);
if (isset($this->attachments)) $o['attachments'] = JsonConverters::toArray('LiveAnswerCallbackAttachment', $this->attachments);
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.
POST /nodes/live-answer/callback HTTP/1.1
Host: team.evovoice.io
Accept: application/json
Content-Type: application/json
Content-Length: length
{"sessionId":"String","flowId":"String","nodeId":"String","clientId":"String","conversationId":"String","aiMinutes":0,"from":"String","to":"String","transcript":[{"date":"\/Date(-62135596800000-0000)\/","role":"String","senderName":"String","targetName":"String","functionName":"String","functionArgs":"String","content":"String"}],"startDate":"\/Date(-62135596800000-0000)\/","endDate":"\/Date(-62135596800000-0000)\/","attachments":[{"fileName":"String","contentType":"String","uri":"String","data":"String"}]}