Trendsic Platform Service

<back to all web services

SmartsheetsAggregateLifeRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
GET,OPTIONS/v1/Smartsheets/AggregateLife/{Type}/{StartDate}/{EndDate}
GET,OPTIONS/v1/Smartsheets/AggregateLife/{Type}/{StartDate}/{EndDate}/{AgentID}
<?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 SmartsheetsAggregate implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgentID=0,
        /** @var string|null */
        public ?string $AgentName=null,
        /** @var float */
        public float $Apps=0.0,
        /** @var float */
        public float $LifePrem=0.0,
        /** @var float */
        public float $TransferPrem=0.0,
        /** @var float */
        public float $FlowPrem=0.0,
        /** @var string|null */
        public ?string $PolicyNumber=null,
        /** @var DateTime|null */
        public ?DateTime $AppDate=null,
        /** @var string|null */
        public ?string $FirstName=null,
        /** @var string|null */
        public ?string $LastName=null,
        /** @var float */
        public float $CPT=0.0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AgentID'])) $this->AgentID = $o['AgentID'];
        if (isset($o['AgentName'])) $this->AgentName = $o['AgentName'];
        if (isset($o['Apps'])) $this->Apps = $o['Apps'];
        if (isset($o['LifePrem'])) $this->LifePrem = $o['LifePrem'];
        if (isset($o['TransferPrem'])) $this->TransferPrem = $o['TransferPrem'];
        if (isset($o['FlowPrem'])) $this->FlowPrem = $o['FlowPrem'];
        if (isset($o['PolicyNumber'])) $this->PolicyNumber = $o['PolicyNumber'];
        if (isset($o['AppDate'])) $this->AppDate = JsonConverters::from('DateTime', $o['AppDate']);
        if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
        if (isset($o['LastName'])) $this->LastName = $o['LastName'];
        if (isset($o['CPT'])) $this->CPT = $o['CPT'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AgentID)) $o['AgentID'] = $this->AgentID;
        if (isset($this->AgentName)) $o['AgentName'] = $this->AgentName;
        if (isset($this->Apps)) $o['Apps'] = $this->Apps;
        if (isset($this->LifePrem)) $o['LifePrem'] = $this->LifePrem;
        if (isset($this->TransferPrem)) $o['TransferPrem'] = $this->TransferPrem;
        if (isset($this->FlowPrem)) $o['FlowPrem'] = $this->FlowPrem;
        if (isset($this->PolicyNumber)) $o['PolicyNumber'] = $this->PolicyNumber;
        if (isset($this->AppDate)) $o['AppDate'] = JsonConverters::to('DateTime', $this->AppDate);
        if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
        if (isset($this->LastName)) $o['LastName'] = $this->LastName;
        if (isset($this->CPT)) $o['CPT'] = $this->CPT;
        return empty($o) ? new class(){} : $o;
    }
}

class SmartsheetsAggregateAllResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<SmartsheetsAggregate>|null */
        public ?array $SmartsheetAggregates=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['SmartsheetAggregates'])) $this->SmartsheetAggregates = JsonConverters::fromArray('SmartsheetsAggregate', $o['SmartsheetAggregates']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->SmartsheetAggregates)) $o['SmartsheetAggregates'] = JsonConverters::toArray('SmartsheetsAggregate', $this->SmartsheetAggregates);
        return empty($o) ? new class(){} : $o;
    }
}

class SmartsheetsAggregateLifeRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Type=null,
        /** @var DateTime */
        public DateTime $StartDate=new DateTime(),
        /** @var DateTime */
        public DateTime $EndDate=new DateTime(),
        /** @var int */
        public int $AgentID=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Type'])) $this->Type = $o['Type'];
        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['AgentID'])) $this->AgentID = $o['AgentID'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Type)) $o['Type'] = $this->Type;
        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->AgentID)) $o['AgentID'] = $this->AgentID;
        return empty($o) ? new class(){} : $o;
    }
}

PHP SmartsheetsAggregateLifeRequest 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.

GET /v1/Smartsheets/AggregateLife/{Type}/{StartDate}/{EndDate} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
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"}},"SmartsheetAggregates":[{"AgentID":0,"AgentName":"String","Apps":0,"LifePrem":0,"TransferPrem":0,"FlowPrem":0,"PolicyNumber":"String","AppDate":"0001-01-01T00:00:00.0000000","FirstName":"String","LastName":"String","CPT":0}]}