Requires any of the roles: | SystemAdministrator, Manager |
GET | /dashboard/call-center |
---|
<?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 CallCenterDashboardAgent implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $name=null,
/** @var array<string>|null */
public ?array $queues=null,
/** @var string|null */
public ?string $agentState=null,
/** @var string|null */
public ?string $callState=null,
/** @var string|null */
public ?string $signInTime=null,
/** @var string|null */
public ?string $signInDuration=null,
/** @var string|null */
public ?string $percentAvailable=null,
/** @var string|null */
public ?string $avgBusyIn=null,
/** @var string|null */
public ?string $avgWrapUp=null,
/** @var string|null */
public ?string $dateOfLastCall=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['queues'])) $this->queues = JsonConverters::fromArray('string', $o['queues']);
if (isset($o['agentState'])) $this->agentState = $o['agentState'];
if (isset($o['callState'])) $this->callState = $o['callState'];
if (isset($o['signInTime'])) $this->signInTime = $o['signInTime'];
if (isset($o['signInDuration'])) $this->signInDuration = $o['signInDuration'];
if (isset($o['percentAvailable'])) $this->percentAvailable = $o['percentAvailable'];
if (isset($o['avgBusyIn'])) $this->avgBusyIn = $o['avgBusyIn'];
if (isset($o['avgWrapUp'])) $this->avgWrapUp = $o['avgWrapUp'];
if (isset($o['dateOfLastCall'])) $this->dateOfLastCall = $o['dateOfLastCall'];
}
/** @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->queues)) $o['queues'] = JsonConverters::toArray('string', $this->queues);
if (isset($this->agentState)) $o['agentState'] = $this->agentState;
if (isset($this->callState)) $o['callState'] = $this->callState;
if (isset($this->signInTime)) $o['signInTime'] = $this->signInTime;
if (isset($this->signInDuration)) $o['signInDuration'] = $this->signInDuration;
if (isset($this->percentAvailable)) $o['percentAvailable'] = $this->percentAvailable;
if (isset($this->avgBusyIn)) $o['avgBusyIn'] = $this->avgBusyIn;
if (isset($this->avgWrapUp)) $o['avgWrapUp'] = $this->avgWrapUp;
if (isset($this->dateOfLastCall)) $o['dateOfLastCall'] = $this->dateOfLastCall;
return empty($o) ? new class(){} : $o;
}
}
class CallCenterDashboardQueue implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $name=null,
/** @var int */
public int $numAgents=0,
/** @var int */
public int $numCallsQueued=0,
/** @var string|null */
public ?string $longestWaitingCall=null,
/** @var string|null */
public ?string $expectedWaitTime=null,
/** @var string|null */
public ?string $expectedHoldTime=null,
/** @var string|null */
public ?string $averageSpeedOfAnswer=null,
/** @var int */
public int $idleAgents=0,
/** @var int */
public int $unavailableAgents=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['numAgents'])) $this->numAgents = $o['numAgents'];
if (isset($o['numCallsQueued'])) $this->numCallsQueued = $o['numCallsQueued'];
if (isset($o['longestWaitingCall'])) $this->longestWaitingCall = $o['longestWaitingCall'];
if (isset($o['expectedWaitTime'])) $this->expectedWaitTime = $o['expectedWaitTime'];
if (isset($o['expectedHoldTime'])) $this->expectedHoldTime = $o['expectedHoldTime'];
if (isset($o['averageSpeedOfAnswer'])) $this->averageSpeedOfAnswer = $o['averageSpeedOfAnswer'];
if (isset($o['idleAgents'])) $this->idleAgents = $o['idleAgents'];
if (isset($o['unavailableAgents'])) $this->unavailableAgents = $o['unavailableAgents'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->numAgents)) $o['numAgents'] = $this->numAgents;
if (isset($this->numCallsQueued)) $o['numCallsQueued'] = $this->numCallsQueued;
if (isset($this->longestWaitingCall)) $o['longestWaitingCall'] = $this->longestWaitingCall;
if (isset($this->expectedWaitTime)) $o['expectedWaitTime'] = $this->expectedWaitTime;
if (isset($this->expectedHoldTime)) $o['expectedHoldTime'] = $this->expectedHoldTime;
if (isset($this->averageSpeedOfAnswer)) $o['averageSpeedOfAnswer'] = $this->averageSpeedOfAnswer;
if (isset($this->idleAgents)) $o['idleAgents'] = $this->idleAgents;
if (isset($this->unavailableAgents)) $o['unavailableAgents'] = $this->unavailableAgents;
return empty($o) ? new class(){} : $o;
}
}
class CallCenterDashboardCall implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $customer=null,
/** @var string|null */
public ?string $queue=null,
/** @var string|null */
public ?string $agent=null,
/** @var string|null */
public ?string $state=null,
/** @var string|null */
public ?string $duration=null,
/** @var string|null */
public ?string $hold=null,
/** @var string|null */
public ?string $extraInfo=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['customer'])) $this->customer = $o['customer'];
if (isset($o['queue'])) $this->queue = $o['queue'];
if (isset($o['agent'])) $this->agent = $o['agent'];
if (isset($o['state'])) $this->state = $o['state'];
if (isset($o['duration'])) $this->duration = $o['duration'];
if (isset($o['hold'])) $this->hold = $o['hold'];
if (isset($o['extraInfo'])) $this->extraInfo = $o['extraInfo'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->customer)) $o['customer'] = $this->customer;
if (isset($this->queue)) $o['queue'] = $this->queue;
if (isset($this->agent)) $o['agent'] = $this->agent;
if (isset($this->state)) $o['state'] = $this->state;
if (isset($this->duration)) $o['duration'] = $this->duration;
if (isset($this->hold)) $o['hold'] = $this->hold;
if (isset($this->extraInfo)) $o['extraInfo'] = $this->extraInfo;
return empty($o) ? new class(){} : $o;
}
}
class CallCenterDashboard implements JsonSerializable
{
public function __construct(
/** @var array<CallCenterDashboardAgent>|null */
public ?array $agents=null,
/** @var array<CallCenterDashboardQueue>|null */
public ?array $queues=null,
/** @var array<CallCenterDashboardCall>|null */
public ?array $calls=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['agents'])) $this->agents = JsonConverters::fromArray('CallCenterDashboardAgent', $o['agents']);
if (isset($o['queues'])) $this->queues = JsonConverters::fromArray('CallCenterDashboardQueue', $o['queues']);
if (isset($o['calls'])) $this->calls = JsonConverters::fromArray('CallCenterDashboardCall', $o['calls']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->agents)) $o['agents'] = JsonConverters::toArray('CallCenterDashboardAgent', $this->agents);
if (isset($this->queues)) $o['queues'] = JsonConverters::toArray('CallCenterDashboardQueue', $this->queues);
if (isset($this->calls)) $o['calls'] = JsonConverters::toArray('CallCenterDashboardCall', $this->calls);
return empty($o) ? new class(){} : $o;
}
}
/** @description Returns the call center dashboard data */
// @Api(Description="Returns the call center dashboard data")
class GetCallCenterDashboard implements IPost, JsonSerializable
{
public function __construct(
/** @description The account ID to retrieve for */
// @ApiMember(Description="The account ID to retrieve for")
/** @var string|null */
public ?string $accountId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
return empty($o) ? new class(){} : $o;
}
}
PHP GetCallCenterDashboard DTOs
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 /dashboard/call-center HTTP/1.1 Host: team.evovoice.io Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"agents":[{"id":"String","name":"String","queues":["String"],"agentState":"String","callState":"String","signInTime":"String","signInDuration":"String","percentAvailable":"String","avgBusyIn":"String","avgWrapUp":"String","dateOfLastCall":"String"}],"queues":[{"name":"String","numAgents":0,"numCallsQueued":0,"longestWaitingCall":"String","expectedWaitTime":"String","expectedHoldTime":"String","averageSpeedOfAnswer":"String","idleAgents":0,"unavailableAgents":0}],"calls":[{"id":"String","customer":"String","queue":"String","agent":"String","state":"String","duration":"String","hold":"String","extraInfo":"String"}]}