Trendsic Platform Service

<back to all web services

LeaderboardRequest

The following routes are available for this service:
POST,OPTIONS/v1/Leaderboard
GET,OPTIONS/v1/Leaderboard/{LeaderboardType}/{StartDate}/{EndDate}
<?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 Leaderboard implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Position=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Location=null,
        /** @var float */
        public float $LifeCashFlow=0.0,
        /** @var float */
        public float $AnnuityCashFlow=0.0,
        /** @var float */
        public float $TotalCashFlow=0.0,
        /** @var float */
        public float $PremiumLife=0.0,
        /** @var float */
        public float $PremiumAnnuity=0.0,
        /** @var float */
        public float $PointsLife=0.0,
        /** @var float */
        public float $PointsAnnuity=0.0,
        /** @var float */
        public float $TotalPoints=0.0,
        /** @var bool|null */
        public ?bool $IsMVP=null,
        /** @var bool|null */
        public ?bool $IsRVP=null,
        /** @var bool|null */
        public ?bool $IsAVP=null,
        /** @var bool|null */
        public ?bool $IsAgent=null,
        /** @var string|null */
        public ?string $Phone=null,
        /** @var string|null */
        public ?string $Upline1Name=null,
        /** @var string|null */
        public ?string $Upline2Name=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Position'])) $this->Position = $o['Position'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Location'])) $this->Location = $o['Location'];
        if (isset($o['LifeCashFlow'])) $this->LifeCashFlow = $o['LifeCashFlow'];
        if (isset($o['AnnuityCashFlow'])) $this->AnnuityCashFlow = $o['AnnuityCashFlow'];
        if (isset($o['TotalCashFlow'])) $this->TotalCashFlow = $o['TotalCashFlow'];
        if (isset($o['PremiumLife'])) $this->PremiumLife = $o['PremiumLife'];
        if (isset($o['PremiumAnnuity'])) $this->PremiumAnnuity = $o['PremiumAnnuity'];
        if (isset($o['PointsLife'])) $this->PointsLife = $o['PointsLife'];
        if (isset($o['PointsAnnuity'])) $this->PointsAnnuity = $o['PointsAnnuity'];
        if (isset($o['TotalPoints'])) $this->TotalPoints = $o['TotalPoints'];
        if (isset($o['IsMVP'])) $this->IsMVP = $o['IsMVP'];
        if (isset($o['IsRVP'])) $this->IsRVP = $o['IsRVP'];
        if (isset($o['IsAVP'])) $this->IsAVP = $o['IsAVP'];
        if (isset($o['IsAgent'])) $this->IsAgent = $o['IsAgent'];
        if (isset($o['Phone'])) $this->Phone = $o['Phone'];
        if (isset($o['Upline1Name'])) $this->Upline1Name = $o['Upline1Name'];
        if (isset($o['Upline2Name'])) $this->Upline2Name = $o['Upline2Name'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Position)) $o['Position'] = $this->Position;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Location)) $o['Location'] = $this->Location;
        if (isset($this->LifeCashFlow)) $o['LifeCashFlow'] = $this->LifeCashFlow;
        if (isset($this->AnnuityCashFlow)) $o['AnnuityCashFlow'] = $this->AnnuityCashFlow;
        if (isset($this->TotalCashFlow)) $o['TotalCashFlow'] = $this->TotalCashFlow;
        if (isset($this->PremiumLife)) $o['PremiumLife'] = $this->PremiumLife;
        if (isset($this->PremiumAnnuity)) $o['PremiumAnnuity'] = $this->PremiumAnnuity;
        if (isset($this->PointsLife)) $o['PointsLife'] = $this->PointsLife;
        if (isset($this->PointsAnnuity)) $o['PointsAnnuity'] = $this->PointsAnnuity;
        if (isset($this->TotalPoints)) $o['TotalPoints'] = $this->TotalPoints;
        if (isset($this->IsMVP)) $o['IsMVP'] = $this->IsMVP;
        if (isset($this->IsRVP)) $o['IsRVP'] = $this->IsRVP;
        if (isset($this->IsAVP)) $o['IsAVP'] = $this->IsAVP;
        if (isset($this->IsAgent)) $o['IsAgent'] = $this->IsAgent;
        if (isset($this->Phone)) $o['Phone'] = $this->Phone;
        if (isset($this->Upline1Name)) $o['Upline1Name'] = $this->Upline1Name;
        if (isset($this->Upline2Name)) $o['Upline2Name'] = $this->Upline2Name;
        return empty($o) ? new class(){} : $o;
    }
}

class LeaderboardResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<Leaderboard>|null */
        public ?array $AllData=null,
        /** @var array<Leaderboard>|null */
        public ?array $MVP=null,
        /** @var array<Leaderboard>|null */
        public ?array $AVP=null,
        /** @var array<Leaderboard>|null */
        public ?array $RVP=null,
        /** @var array<Leaderboard>|null */
        public ?array $Agents=null
    ) {
    }

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

class LeaderboardRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $StartDate=null,
        /** @var string|null */
        public ?string $EndDate=null,
        /** @var string|null */
        public ?string $LeaderboardType=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['StartDate'])) $this->StartDate = $o['StartDate'];
        if (isset($o['EndDate'])) $this->EndDate = $o['EndDate'];
        if (isset($o['LeaderboardType'])) $this->LeaderboardType = $o['LeaderboardType'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->StartDate)) $o['StartDate'] = $this->StartDate;
        if (isset($this->EndDate)) $o['EndDate'] = $this->EndDate;
        if (isset($this->LeaderboardType)) $o['LeaderboardType'] = $this->LeaderboardType;
        return empty($o) ? new class(){} : $o;
    }
}

PHP LeaderboardRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

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

POST /v1/Leaderboard HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	StartDate: String,
	EndDate: String,
	LeaderboardType: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	AllData: 
	[
		{
			Position: 0,
			Name: String,
			Location: String,
			LifeCashFlow: 0,
			AnnuityCashFlow: 0,
			TotalCashFlow: 0,
			PremiumLife: 0,
			PremiumAnnuity: 0,
			PointsLife: 0,
			PointsAnnuity: 0,
			TotalPoints: 0,
			IsMVP: False,
			IsRVP: False,
			IsAVP: False,
			IsAgent: False,
			Phone: String,
			Upline1Name: String,
			Upline2Name: String
		}
	],
	MVP: 
	[
		{
			Position: 0,
			Name: String,
			Location: String,
			LifeCashFlow: 0,
			AnnuityCashFlow: 0,
			TotalCashFlow: 0,
			PremiumLife: 0,
			PremiumAnnuity: 0,
			PointsLife: 0,
			PointsAnnuity: 0,
			TotalPoints: 0,
			IsMVP: False,
			IsRVP: False,
			IsAVP: False,
			IsAgent: False,
			Phone: String,
			Upline1Name: String,
			Upline2Name: String
		}
	],
	AVP: 
	[
		{
			Position: 0,
			Name: String,
			Location: String,
			LifeCashFlow: 0,
			AnnuityCashFlow: 0,
			TotalCashFlow: 0,
			PremiumLife: 0,
			PremiumAnnuity: 0,
			PointsLife: 0,
			PointsAnnuity: 0,
			TotalPoints: 0,
			IsMVP: False,
			IsRVP: False,
			IsAVP: False,
			IsAgent: False,
			Phone: String,
			Upline1Name: String,
			Upline2Name: String
		}
	],
	RVP: 
	[
		{
			Position: 0,
			Name: String,
			Location: String,
			LifeCashFlow: 0,
			AnnuityCashFlow: 0,
			TotalCashFlow: 0,
			PremiumLife: 0,
			PremiumAnnuity: 0,
			PointsLife: 0,
			PointsAnnuity: 0,
			TotalPoints: 0,
			IsMVP: False,
			IsRVP: False,
			IsAVP: False,
			IsAgent: False,
			Phone: String,
			Upline1Name: String,
			Upline2Name: String
		}
	],
	Agents: 
	[
		{
			Position: 0,
			Name: String,
			Location: String,
			LifeCashFlow: 0,
			AnnuityCashFlow: 0,
			TotalCashFlow: 0,
			PremiumLife: 0,
			PremiumAnnuity: 0,
			PointsLife: 0,
			PointsAnnuity: 0,
			TotalPoints: 0,
			IsMVP: False,
			IsRVP: False,
			IsAVP: False,
			IsAgent: False,
			Phone: String,
			Upline1Name: String,
			Upline2Name: String
		}
	]
}