Trendsic Platform Service

<back to all web services

ActivityPlanRequest

Requires Authentication
Requires any of the roles:Worker, Agent, Administrator, Worker, Agent, Administrator
The following routes are available for this service:
POST,OPTIONS/v1/ActivityPlan
GET,OPTIONS/v1/ActivityPlan/{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 ActivityPlanRequest implements JsonSerializable
{
    public function __construct(
        /** @var ActivityPlan|null */
        public ?ActivityPlan $ActivityPlan=null,
        /** @var int */
        public int $AgentId=0,
        /** @var DateTime */
        public DateTime $DateFrom=new DateTime(),
        /** @var DateTime */
        public DateTime $DateTo=new DateTime(),
        /** @var int */
        public int $ApplicationGoal=0,
        /** @var int */
        public int $AppointmentSetGoal=0,
        /** @var int */
        public int $LearningGoal=0,
        /** @var int */
        public int $MarketingGoal=0,
        /** @var int */
        public int $ReferralGoal=0,
        /** @var int */
        public int $LeadGoal=0,
        /** @var int */
        public int $ClientUpdateGoal=0,
        /** @var int */
        public int $FirstContactGoal=0,
        /** @var int */
        public int $FirstAppointmentGoal=0,
        /** @var int */
        public int $SecondAppointmentGoal=0,
        /** @var int */
        public int $SecondAppointmentSetGoal=0,
        /** @var int */
        public int $MonthlyCashFlowGoal=0,
        /** @var int */
        public int $YTDCashFlowGoal=0,
        /** @var int */
        public int $RecruitGoal=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ActivityPlan'])) $this->ActivityPlan = JsonConverters::from('ActivityPlan', $o['ActivityPlan']);
        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']);
        if (isset($o['ApplicationGoal'])) $this->ApplicationGoal = $o['ApplicationGoal'];
        if (isset($o['AppointmentSetGoal'])) $this->AppointmentSetGoal = $o['AppointmentSetGoal'];
        if (isset($o['LearningGoal'])) $this->LearningGoal = $o['LearningGoal'];
        if (isset($o['MarketingGoal'])) $this->MarketingGoal = $o['MarketingGoal'];
        if (isset($o['ReferralGoal'])) $this->ReferralGoal = $o['ReferralGoal'];
        if (isset($o['LeadGoal'])) $this->LeadGoal = $o['LeadGoal'];
        if (isset($o['ClientUpdateGoal'])) $this->ClientUpdateGoal = $o['ClientUpdateGoal'];
        if (isset($o['FirstContactGoal'])) $this->FirstContactGoal = $o['FirstContactGoal'];
        if (isset($o['FirstAppointmentGoal'])) $this->FirstAppointmentGoal = $o['FirstAppointmentGoal'];
        if (isset($o['SecondAppointmentGoal'])) $this->SecondAppointmentGoal = $o['SecondAppointmentGoal'];
        if (isset($o['SecondAppointmentSetGoal'])) $this->SecondAppointmentSetGoal = $o['SecondAppointmentSetGoal'];
        if (isset($o['MonthlyCashFlowGoal'])) $this->MonthlyCashFlowGoal = $o['MonthlyCashFlowGoal'];
        if (isset($o['YTDCashFlowGoal'])) $this->YTDCashFlowGoal = $o['YTDCashFlowGoal'];
        if (isset($o['RecruitGoal'])) $this->RecruitGoal = $o['RecruitGoal'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ActivityPlan)) $o['ActivityPlan'] = JsonConverters::to('ActivityPlan', $this->ActivityPlan);
        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);
        if (isset($this->ApplicationGoal)) $o['ApplicationGoal'] = $this->ApplicationGoal;
        if (isset($this->AppointmentSetGoal)) $o['AppointmentSetGoal'] = $this->AppointmentSetGoal;
        if (isset($this->LearningGoal)) $o['LearningGoal'] = $this->LearningGoal;
        if (isset($this->MarketingGoal)) $o['MarketingGoal'] = $this->MarketingGoal;
        if (isset($this->ReferralGoal)) $o['ReferralGoal'] = $this->ReferralGoal;
        if (isset($this->LeadGoal)) $o['LeadGoal'] = $this->LeadGoal;
        if (isset($this->ClientUpdateGoal)) $o['ClientUpdateGoal'] = $this->ClientUpdateGoal;
        if (isset($this->FirstContactGoal)) $o['FirstContactGoal'] = $this->FirstContactGoal;
        if (isset($this->FirstAppointmentGoal)) $o['FirstAppointmentGoal'] = $this->FirstAppointmentGoal;
        if (isset($this->SecondAppointmentGoal)) $o['SecondAppointmentGoal'] = $this->SecondAppointmentGoal;
        if (isset($this->SecondAppointmentSetGoal)) $o['SecondAppointmentSetGoal'] = $this->SecondAppointmentSetGoal;
        if (isset($this->MonthlyCashFlowGoal)) $o['MonthlyCashFlowGoal'] = $this->MonthlyCashFlowGoal;
        if (isset($this->YTDCashFlowGoal)) $o['YTDCashFlowGoal'] = $this->YTDCashFlowGoal;
        if (isset($this->RecruitGoal)) $o['RecruitGoal'] = $this->RecruitGoal;
        return empty($o) ? new class(){} : $o;
    }
}

PHP ActivityPlanRequest 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

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/ActivityPlan HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"ActivityPlan":{"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},"AgentId":0,"DateFrom":"0001-01-01T00:00:00.0000000","DateTo":"0001-01-01T00:00:00.0000000","ApplicationGoal":0,"AppointmentSetGoal":0,"LearningGoal":0,"MarketingGoal":0,"ReferralGoal":0,"LeadGoal":0,"ClientUpdateGoal":0,"FirstContactGoal":0,"FirstAppointmentGoal":0,"SecondAppointmentGoal":0,"SecondAppointmentSetGoal":0,"MonthlyCashFlowGoal":0,"YTDCashFlowGoal":0,"RecruitGoal":0}
HTTP/1.1 200 OK
Content-Type: application/json
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}}