Requires any of the roles: | SystemAdministrator, Manager, Customer |
All Verbs | /reports/call-outcome |
---|
<?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 ReportRequest implements IPost, JsonSerializable
{
public function __construct(
/** @description The account ID this report should be run for */
// @ApiMember(Description="The account ID this report should be run for")
/** @var string|null */
public ?string $accountId=null,
/** @description The email address to notify after the report is run */
// @ApiMember(Description="The email address to notify after the report is run")
/** @var string|null */
public ?string $emailAddressToNotify=null,
/** @description The webhook to call after the report is complete with the data from the report */
// @ApiMember(Description="The webhook to call after the report is complete with the data from the report")
/** @var string|null */
public ?string $webhookUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
if (isset($o['emailAddressToNotify'])) $this->emailAddressToNotify = $o['emailAddressToNotify'];
if (isset($o['webhookUrl'])) $this->webhookUrl = $o['webhookUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
if (isset($this->emailAddressToNotify)) $o['emailAddressToNotify'] = $this->emailAddressToNotify;
if (isset($this->webhookUrl)) $o['webhookUrl'] = $this->webhookUrl;
return empty($o) ? new class(){} : $o;
}
}
enum ReportStatuses : string
{
case Queued = 'Queued';
case Running = 'Running';
case Completed = 'Completed';
case Error = 'Error';
}
class ReportInfo implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $name=null,
/** @var ReportStatuses|null */
public ?ReportStatuses $status=null,
/** @var string|null */
public ?string $statusMessage=null,
/** @var string|null */
public ?string $dateCreated=null,
/** @var string|null */
public ?string $dateUpdated=null,
/** @var string|null */
public ?string $downloadLink=null,
/** @var string|null */
public ?string $jobId=null,
/** @var string|null */
public ?string $emailAddressToNotify=null,
/** @var string|null */
public ?string $server=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['status'])) $this->status = JsonConverters::from('ReportStatuses', $o['status']);
if (isset($o['statusMessage'])) $this->statusMessage = $o['statusMessage'];
if (isset($o['dateCreated'])) $this->dateCreated = $o['dateCreated'];
if (isset($o['dateUpdated'])) $this->dateUpdated = $o['dateUpdated'];
if (isset($o['downloadLink'])) $this->downloadLink = $o['downloadLink'];
if (isset($o['jobId'])) $this->jobId = $o['jobId'];
if (isset($o['emailAddressToNotify'])) $this->emailAddressToNotify = $o['emailAddressToNotify'];
if (isset($o['server'])) $this->server = $o['server'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->status)) $o['status'] = JsonConverters::to('ReportStatuses', $this->status);
if (isset($this->statusMessage)) $o['statusMessage'] = $this->statusMessage;
if (isset($this->dateCreated)) $o['dateCreated'] = $this->dateCreated;
if (isset($this->dateUpdated)) $o['dateUpdated'] = $this->dateUpdated;
if (isset($this->downloadLink)) $o['downloadLink'] = $this->downloadLink;
if (isset($this->jobId)) $o['jobId'] = $this->jobId;
if (isset($this->emailAddressToNotify)) $o['emailAddressToNotify'] = $this->emailAddressToNotify;
if (isset($this->server)) $o['server'] = $this->server;
return empty($o) ? new class(){} : $o;
}
}
class CallOutcomeReport extends ReportRequest implements JsonSerializable
{
/**
* @param string|null $accountId
* @param string|null $emailAddressToNotify
* @param string|null $webhookUrl
*/
public function __construct(
?string $accountId=null,
?string $emailAddressToNotify=null,
?string $webhookUrl=null,
/** @var string|null */
public ?string $startDate=null,
/** @var string|null */
public ?string $endDate=null,
/** @var string|null */
public ?string $timeZoneId=null,
/** @var string|null */
public ?string $customerId=null,
/** @var string|null */
public ?string $specificState=null,
/** @var bool|null */
public ?bool $includeArchivedSessions=null
) {
parent::__construct($accountId,$emailAddressToNotify,$webhookUrl);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['startDate'])) $this->startDate = $o['startDate'];
if (isset($o['endDate'])) $this->endDate = $o['endDate'];
if (isset($o['timeZoneId'])) $this->timeZoneId = $o['timeZoneId'];
if (isset($o['customerId'])) $this->customerId = $o['customerId'];
if (isset($o['specificState'])) $this->specificState = $o['specificState'];
if (isset($o['includeArchivedSessions'])) $this->includeArchivedSessions = $o['includeArchivedSessions'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->startDate)) $o['startDate'] = $this->startDate;
if (isset($this->endDate)) $o['endDate'] = $this->endDate;
if (isset($this->timeZoneId)) $o['timeZoneId'] = $this->timeZoneId;
if (isset($this->customerId)) $o['customerId'] = $this->customerId;
if (isset($this->specificState)) $o['specificState'] = $this->specificState;
if (isset($this->includeArchivedSessions)) $o['includeArchivedSessions'] = $this->includeArchivedSessions;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /reports/call-outcome HTTP/1.1
Host: team.evovoice.io
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CallOutcomeReport xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Reports">
<AccountId>String</AccountId>
<EmailAddressToNotify>String</EmailAddressToNotify>
<WebhookUrl>String</WebhookUrl>
<CustomerId>String</CustomerId>
<EndDate>String</EndDate>
<IncludeArchivedSessions>false</IncludeArchivedSessions>
<SpecificState>String</SpecificState>
<StartDate>String</StartDate>
<TimeZoneId>String</TimeZoneId>
</CallOutcomeReport>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ReportInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Reports"> <DateCreated>String</DateCreated> <DateUpdated>String</DateUpdated> <DownloadLink>String</DownloadLink> <EmailAddressToNotify>String</EmailAddressToNotify> <Id>String</Id> <JobId>String</JobId> <Name>String</Name> <Server>String</Server> <Status>Queued</Status> <StatusMessage>String</StatusMessage> </ReportInfo>