Trendsic Platform Service

<back to all web services

FinanceRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dashboard/finance
import 'package:servicestack/servicestack.dart';

class DashboardStatTile implements IConvertible
{
    String? Key;
    String? Label;
    double? Value;
    double? PreviousValue;
    String? Unit;
    double? DeltaPct;

    DashboardStatTile({this.Key,this.Label,this.Value,this.PreviousValue,this.Unit,this.DeltaPct});
    DashboardStatTile.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Key = json['Key'];
        Label = json['Label'];
        Value = JsonConverters.toDouble(json['Value']);
        PreviousValue = JsonConverters.toDouble(json['PreviousValue']);
        Unit = json['Unit'];
        DeltaPct = JsonConverters.toDouble(json['DeltaPct']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Key': Key,
        'Label': Label,
        'Value': Value,
        'PreviousValue': PreviousValue,
        'Unit': Unit,
        'DeltaPct': DeltaPct
    };

    getTypeName() => "DashboardStatTile";
    TypeContext? context = _ctx;
}

class DashboardSeriesPoint implements IConvertible
{
    String? Label;
    double? Value;

    DashboardSeriesPoint({this.Label,this.Value});
    DashboardSeriesPoint.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Label = json['Label'];
        Value = JsonConverters.toDouble(json['Value']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Label': Label,
        'Value': Value
    };

    getTypeName() => "DashboardSeriesPoint";
    TypeContext? context = _ctx;
}

class DashboardSeries implements IConvertible
{
    String? Name;
    List<DashboardSeriesPoint>? Points = [];

    DashboardSeries({this.Name,this.Points});
    DashboardSeries.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        Points = JsonConverters.fromJson(json['Points'],'List<DashboardSeriesPoint>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'Points': JsonConverters.toJson(Points,'List<DashboardSeriesPoint>',context!)
    };

    getTypeName() => "DashboardSeries";
    TypeContext? context = _ctx;
}

class FinanceLocationRow implements IConvertible
{
    String? LocationName;
    double? ServiceRev;
    double? ProductRev;
    double? SubscriptionRev;
    double? Total;

    FinanceLocationRow({this.LocationName,this.ServiceRev,this.ProductRev,this.SubscriptionRev,this.Total});
    FinanceLocationRow.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        LocationName = json['LocationName'];
        ServiceRev = JsonConverters.toDouble(json['ServiceRev']);
        ProductRev = JsonConverters.toDouble(json['ProductRev']);
        SubscriptionRev = JsonConverters.toDouble(json['SubscriptionRev']);
        Total = JsonConverters.toDouble(json['Total']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'LocationName': LocationName,
        'ServiceRev': ServiceRev,
        'ProductRev': ProductRev,
        'SubscriptionRev': SubscriptionRev,
        'Total': Total
    };

    getTypeName() => "FinanceLocationRow";
    TypeContext? context = _ctx;
}

class FinanceTopRow implements IConvertible
{
    String? Name;
    double? Revenue;

    FinanceTopRow({this.Name,this.Revenue});
    FinanceTopRow.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        Revenue = JsonConverters.toDouble(json['Revenue']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'Revenue': Revenue
    };

    getTypeName() => "FinanceTopRow";
    TypeContext? context = _ctx;
}

class FinanceSubscriptionInfo implements IConvertible
{
    double? Mrr;
    double? Arr;
    int? ActiveCount;
    int? NewCount;
    int? ChurnedCount;
    double? ChurnRatePct;

    FinanceSubscriptionInfo({this.Mrr,this.Arr,this.ActiveCount,this.NewCount,this.ChurnedCount,this.ChurnRatePct});
    FinanceSubscriptionInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Mrr = JsonConverters.toDouble(json['Mrr']);
        Arr = JsonConverters.toDouble(json['Arr']);
        ActiveCount = json['ActiveCount'];
        NewCount = json['NewCount'];
        ChurnedCount = json['ChurnedCount'];
        ChurnRatePct = JsonConverters.toDouble(json['ChurnRatePct']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Mrr': Mrr,
        'Arr': Arr,
        'ActiveCount': ActiveCount,
        'NewCount': NewCount,
        'ChurnedCount': ChurnedCount,
        'ChurnRatePct': ChurnRatePct
    };

    getTypeName() => "FinanceSubscriptionInfo";
    TypeContext? context = _ctx;
}

class FinanceResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    List<DashboardStatTile>? Stats = [];
    List<DashboardSeries>? Trend = [];
    DashboardSeries? SourceMix;
    List<FinanceLocationRow>? ByLocation = [];
    List<FinanceTopRow>? TopServices = [];
    List<FinanceTopRow>? TopProducts = [];
    FinanceSubscriptionInfo? Subscriptions;

    FinanceResponse({this.ResponseStatus,this.Stats,this.Trend,this.SourceMix,this.ByLocation,this.TopServices,this.TopProducts,this.Subscriptions});
    FinanceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        Stats = JsonConverters.fromJson(json['Stats'],'List<DashboardStatTile>',context!);
        Trend = JsonConverters.fromJson(json['Trend'],'List<DashboardSeries>',context!);
        SourceMix = JsonConverters.fromJson(json['SourceMix'],'DashboardSeries',context!);
        ByLocation = JsonConverters.fromJson(json['ByLocation'],'List<FinanceLocationRow>',context!);
        TopServices = JsonConverters.fromJson(json['TopServices'],'List<FinanceTopRow>',context!);
        TopProducts = JsonConverters.fromJson(json['TopProducts'],'List<FinanceTopRow>',context!);
        Subscriptions = JsonConverters.fromJson(json['Subscriptions'],'FinanceSubscriptionInfo',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
        'Stats': JsonConverters.toJson(Stats,'List<DashboardStatTile>',context!),
        'Trend': JsonConverters.toJson(Trend,'List<DashboardSeries>',context!),
        'SourceMix': JsonConverters.toJson(SourceMix,'DashboardSeries',context!),
        'ByLocation': JsonConverters.toJson(ByLocation,'List<FinanceLocationRow>',context!),
        'TopServices': JsonConverters.toJson(TopServices,'List<FinanceTopRow>',context!),
        'TopProducts': JsonConverters.toJson(TopProducts,'List<FinanceTopRow>',context!),
        'Subscriptions': JsonConverters.toJson(Subscriptions,'FinanceSubscriptionInfo',context!)
    };

    getTypeName() => "FinanceResponse";
    TypeContext? context = _ctx;
}

class FinanceRequest implements IConvertible
{
    DateTime? FromDate;
    DateTime? ToDate;
    List<String>? LocationIds = [];

    FinanceRequest({this.FromDate,this.ToDate,this.LocationIds});
    FinanceRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        FromDate = JsonConverters.fromJson(json['FromDate'],'DateTime',context!);
        ToDate = JsonConverters.fromJson(json['ToDate'],'DateTime',context!);
        LocationIds = JsonConverters.fromJson(json['LocationIds'],'List<String>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'FromDate': JsonConverters.toJson(FromDate,'DateTime',context!),
        'ToDate': JsonConverters.toJson(ToDate,'DateTime',context!),
        'LocationIds': JsonConverters.toJson(LocationIds,'List<String>',context!)
    };

    getTypeName() => "FinanceRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'DashboardStatTile': TypeInfo(TypeOf.Class, create:() => DashboardStatTile()),
    'DashboardSeriesPoint': TypeInfo(TypeOf.Class, create:() => DashboardSeriesPoint()),
    'DashboardSeries': TypeInfo(TypeOf.Class, create:() => DashboardSeries()),
    'List<DashboardSeriesPoint>': TypeInfo(TypeOf.Class, create:() => <DashboardSeriesPoint>[]),
    'FinanceLocationRow': TypeInfo(TypeOf.Class, create:() => FinanceLocationRow()),
    'FinanceTopRow': TypeInfo(TypeOf.Class, create:() => FinanceTopRow()),
    'FinanceSubscriptionInfo': TypeInfo(TypeOf.Class, create:() => FinanceSubscriptionInfo()),
    'FinanceResponse': TypeInfo(TypeOf.Class, create:() => FinanceResponse()),
    'List<DashboardStatTile>': TypeInfo(TypeOf.Class, create:() => <DashboardStatTile>[]),
    'List<DashboardSeries>': TypeInfo(TypeOf.Class, create:() => <DashboardSeries>[]),
    'List<FinanceLocationRow>': TypeInfo(TypeOf.Class, create:() => <FinanceLocationRow>[]),
    'List<FinanceTopRow>': TypeInfo(TypeOf.Class, create:() => <FinanceTopRow>[]),
    'FinanceRequest': TypeInfo(TypeOf.Class, create:() => FinanceRequest()),
});

Dart FinanceRequest DTOs

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

HTTP + XML

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

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

<FinanceRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <FromDate>0001-01-01T00:00:00</FromDate>
  <LocationIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:guid>00000000-0000-0000-0000-000000000000</d2p1:guid>
  </LocationIds>
  <ToDate>0001-01-01T00:00:00</ToDate>
</FinanceRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<FinanceResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <ByLocation>
    <FinanceLocationRow>
      <LocationName>String</LocationName>
      <ProductRev>0</ProductRev>
      <ServiceRev>0</ServiceRev>
      <SubscriptionRev>0</SubscriptionRev>
      <Total>0</Total>
    </FinanceLocationRow>
  </ByLocation>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <SourceMix>
    <Name>String</Name>
    <Points>
      <DashboardSeriesPoint>
        <Label>String</Label>
        <Value>0</Value>
      </DashboardSeriesPoint>
    </Points>
  </SourceMix>
  <Stats>
    <DashboardStatTile>
      <Key>String</Key>
      <Label>String</Label>
      <PreviousValue>0</PreviousValue>
      <Unit>String</Unit>
      <Value>0</Value>
    </DashboardStatTile>
  </Stats>
  <Subscriptions>
    <ActiveCount>0</ActiveCount>
    <Arr>0</Arr>
    <ChurnRatePct>0</ChurnRatePct>
    <ChurnedCount>0</ChurnedCount>
    <Mrr>0</Mrr>
    <NewCount>0</NewCount>
  </Subscriptions>
  <TopProducts>
    <FinanceTopRow>
      <Name>String</Name>
      <Revenue>0</Revenue>
    </FinanceTopRow>
  </TopProducts>
  <TopServices>
    <FinanceTopRow>
      <Name>String</Name>
      <Revenue>0</Revenue>
    </FinanceTopRow>
  </TopServices>
  <Trend>
    <DashboardSeries>
      <Name>String</Name>
      <Points>
        <DashboardSeriesPoint>
          <Label>String</Label>
          <Value>0</Value>
        </DashboardSeriesPoint>
      </Points>
    </DashboardSeries>
  </Trend>
</FinanceResponse>