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}
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Leaderboard:
    position: int = 0
    name: Optional[str] = None
    location: Optional[str] = None
    life_cash_flow: Decimal = decimal.Decimal(0)
    annuity_cash_flow: Decimal = decimal.Decimal(0)
    total_cash_flow: Decimal = decimal.Decimal(0)
    premium_life: Decimal = decimal.Decimal(0)
    premium_annuity: Decimal = decimal.Decimal(0)
    points_life: Decimal = decimal.Decimal(0)
    points_annuity: Decimal = decimal.Decimal(0)
    total_points: Decimal = decimal.Decimal(0)
    is_m_v_p: bool = False
    is_r_v_p: bool = False
    is_a_v_p: bool = False
    is_agent: bool = False
    phone: Optional[str] = None
    upline1_name: Optional[str] = None
    upline2_name: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LeaderboardResponse:
    response_status: Optional[ResponseStatus] = None
    all_data: List[Leaderboard] = field(default_factory=list)
    mvp: List[Leaderboard] = field(default_factory=list)
    avp: List[Leaderboard] = field(default_factory=list)
    rvp: List[Leaderboard] = field(default_factory=list)
    agents: List[Leaderboard] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LeaderboardRequest:
    start_date: Optional[str] = None
    end_date: Optional[str] = None
    leaderboard_type: Optional[str] = None

Python 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
		}
	]
}