| Requires any of the roles: | Agent, Administrator |
| GET,OPTIONS | /v1/ActivityData/{AgentId}/{DateFrom}/{DateTo} |
|---|
<?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 ActivityPlan implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var int */
public int $AgentId=0,
/** @var int */
public int $EventTypeId=0,
/** @var int */
public int $Goal=0,
/** @var DateTime */
public DateTime $DateFrom=new DateTime(),
/** @var DateTime */
public DateTime $DateTo=new DateTime(),
/** @var DateTime */
public DateTime $DateCreated=new DateTime(),
/** @var int */
public int $MthlyCashFlow=0,
/** @var int */
public int $YTDCashFlow=0,
/** @var int */
public int $Recruit=0,
/** @var string|null */
public ?string $EventTypeName=null,
/** @var int */
public int $Actual=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
if (isset($o['EventTypeId'])) $this->EventTypeId = $o['EventTypeId'];
if (isset($o['Goal'])) $this->Goal = $o['Goal'];
if (isset($o['DateFrom'])) $this->DateFrom = JsonConverters::from('DateTime', $o['DateFrom']);
if (isset($o['DateTo'])) $this->DateTo = JsonConverters::from('DateTime', $o['DateTo']);
if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
if (isset($o['MthlyCashFlow'])) $this->MthlyCashFlow = $o['MthlyCashFlow'];
if (isset($o['YTDCashFlow'])) $this->YTDCashFlow = $o['YTDCashFlow'];
if (isset($o['Recruit'])) $this->Recruit = $o['Recruit'];
if (isset($o['EventTypeName'])) $this->EventTypeName = $o['EventTypeName'];
if (isset($o['Actual'])) $this->Actual = $o['Actual'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
if (isset($this->EventTypeId)) $o['EventTypeId'] = $this->EventTypeId;
if (isset($this->Goal)) $o['Goal'] = $this->Goal;
if (isset($this->DateFrom)) $o['DateFrom'] = JsonConverters::to('DateTime', $this->DateFrom);
if (isset($this->DateTo)) $o['DateTo'] = JsonConverters::to('DateTime', $this->DateTo);
if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
if (isset($this->MthlyCashFlow)) $o['MthlyCashFlow'] = $this->MthlyCashFlow;
if (isset($this->YTDCashFlow)) $o['YTDCashFlow'] = $this->YTDCashFlow;
if (isset($this->Recruit)) $o['Recruit'] = $this->Recruit;
if (isset($this->EventTypeName)) $o['EventTypeName'] = $this->EventTypeName;
if (isset($this->Actual)) $o['Actual'] = $this->Actual;
return empty($o) ? new class(){} : $o;
}
}
class ActivityPlanExtended implements JsonSerializable
{
public function __construct(
/** @var int */
public int $AppCount=0,
/** @var int */
public int $AvgFlow=0,
/** @var int */
public int $AvgTransfer=0,
/** @var int */
public int $AvgLife=0,
/** @var float */
public float $LifePerAnnuity=0.0,
/** @var float */
public float $FlowTransfer=0.0,
/** @var float */
public float $TransferRatio=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AppCount'])) $this->AppCount = $o['AppCount'];
if (isset($o['AvgFlow'])) $this->AvgFlow = $o['AvgFlow'];
if (isset($o['AvgTransfer'])) $this->AvgTransfer = $o['AvgTransfer'];
if (isset($o['AvgLife'])) $this->AvgLife = $o['AvgLife'];
if (isset($o['LifePerAnnuity'])) $this->LifePerAnnuity = $o['LifePerAnnuity'];
if (isset($o['FlowTransfer'])) $this->FlowTransfer = $o['FlowTransfer'];
if (isset($o['TransferRatio'])) $this->TransferRatio = $o['TransferRatio'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AppCount)) $o['AppCount'] = $this->AppCount;
if (isset($this->AvgFlow)) $o['AvgFlow'] = $this->AvgFlow;
if (isset($this->AvgTransfer)) $o['AvgTransfer'] = $this->AvgTransfer;
if (isset($this->AvgLife)) $o['AvgLife'] = $this->AvgLife;
if (isset($this->LifePerAnnuity)) $o['LifePerAnnuity'] = $this->LifePerAnnuity;
if (isset($this->FlowTransfer)) $o['FlowTransfer'] = $this->FlowTransfer;
if (isset($this->TransferRatio)) $o['TransferRatio'] = $this->TransferRatio;
return empty($o) ? new class(){} : $o;
}
}
class ActivityPlanResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<ActivityPlan>|null */
public ?array $ActivityPlans=null,
/** @var ActivityPlanExtended|null */
public ?ActivityPlanExtended $ActivityData=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['ActivityPlans'])) $this->ActivityPlans = JsonConverters::fromArray('ActivityPlan', $o['ActivityPlans']);
if (isset($o['ActivityData'])) $this->ActivityData = JsonConverters::from('ActivityPlanExtended', $o['ActivityData']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->ActivityPlans)) $o['ActivityPlans'] = JsonConverters::toArray('ActivityPlan', $this->ActivityPlans);
if (isset($this->ActivityData)) $o['ActivityData'] = JsonConverters::to('ActivityPlanExtended', $this->ActivityData);
return empty($o) ? new class(){} : $o;
}
}
class ActivityDataRequest implements JsonSerializable
{
public function __construct(
/** @var int */
public int $AgentId=0,
/** @var DateTime */
public DateTime $DateFrom=new DateTime(),
/** @var DateTime */
public DateTime $DateTo=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
if (isset($o['DateFrom'])) $this->DateFrom = JsonConverters::from('DateTime', $o['DateFrom']);
if (isset($o['DateTo'])) $this->DateTo = JsonConverters::from('DateTime', $o['DateTo']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
if (isset($this->DateFrom)) $o['DateFrom'] = JsonConverters::to('DateTime', $this->DateFrom);
if (isset($this->DateTo)) $o['DateTo'] = JsonConverters::to('DateTime', $this->DateTo);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/ActivityData/{AgentId}/{DateFrom}/{DateTo} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"ActivityPlans":[{"Id":0,"AgentId":0,"EventTypeId":0,"Goal":0,"DateFrom":"0001-01-01T00:00:00.0000000","DateTo":"0001-01-01T00:00:00.0000000","DateCreated":"0001-01-01T00:00:00.0000000","MthlyCashFlow":0,"YTDCashFlow":0,"Recruit":0,"EventTypeName":"String","Actual":0}],"ActivityData":{"AppCount":0,"AvgFlow":0,"AvgTransfer":0,"AvgLife":0,"LifePerAnnuity":0,"FlowTransfer":0,"TransferRatio":0}}