Trendsic Platform Service

<back to all web services

KpiV2Request

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dashboard/kpiv2
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 KpiV2LocationRow implements IConvertible
{
    String? LocationName;
    int? Walkins;
    int? Completed;
    double? AvgServiceMinutes;
    double? AbandonmentPct;

    KpiV2LocationRow({this.LocationName,this.Walkins,this.Completed,this.AvgServiceMinutes,this.AbandonmentPct});
    KpiV2LocationRow.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        LocationName = json['LocationName'];
        Walkins = json['Walkins'];
        Completed = json['Completed'];
        AvgServiceMinutes = JsonConverters.toDouble(json['AvgServiceMinutes']);
        AbandonmentPct = JsonConverters.toDouble(json['AbandonmentPct']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'LocationName': LocationName,
        'Walkins': Walkins,
        'Completed': Completed,
        'AvgServiceMinutes': AvgServiceMinutes,
        'AbandonmentPct': AbandonmentPct
    };

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

class KpiV2WorkerRow implements IConvertible
{
    String? WorkerName;
    int? Completed;
    double? AvgServiceMinutes;

    KpiV2WorkerRow({this.WorkerName,this.Completed,this.AvgServiceMinutes});
    KpiV2WorkerRow.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'WorkerName': WorkerName,
        'Completed': Completed,
        'AvgServiceMinutes': AvgServiceMinutes
    };

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

class KpiV2HeatPoint implements IConvertible
{
    int? Dow;
    int? Hr;
    int? Cnt;

    KpiV2HeatPoint({this.Dow,this.Hr,this.Cnt});
    KpiV2HeatPoint.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Dow = json['Dow'];
        Hr = json['Hr'];
        Cnt = json['Cnt'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Dow': Dow,
        'Hr': Hr,
        'Cnt': Cnt
    };

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

class KpiV2LiveRow implements IConvertible
{
    String? LocationName;
    int? Waiting;
    int? InProgress;

    KpiV2LiveRow({this.LocationName,this.Waiting,this.InProgress});
    KpiV2LiveRow.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        LocationName = json['LocationName'];
        Waiting = json['Waiting'];
        InProgress = json['InProgress'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'LocationName': LocationName,
        'Waiting': Waiting,
        'InProgress': InProgress
    };

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

class KpiV2Response implements IConvertible
{
    ResponseStatus? ResponseStatus;
    List<DashboardStatTile>? Stats = [];
    List<DashboardSeries>? Trend = [];
    DashboardSeries? ServicesByType;
    List<KpiV2LocationRow>? LocationLeaderboard = [];
    List<KpiV2WorkerRow>? WorkerProductivity = [];
    List<KpiV2HeatPoint>? Heatmap = [];
    List<KpiV2LiveRow>? LiveQueue = [];

    KpiV2Response({this.ResponseStatus,this.Stats,this.Trend,this.ServicesByType,this.LocationLeaderboard,this.WorkerProductivity,this.Heatmap,this.LiveQueue});
    KpiV2Response.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!);
        ServicesByType = JsonConverters.fromJson(json['ServicesByType'],'DashboardSeries',context!);
        LocationLeaderboard = JsonConverters.fromJson(json['LocationLeaderboard'],'List<KpiV2LocationRow>',context!);
        WorkerProductivity = JsonConverters.fromJson(json['WorkerProductivity'],'List<KpiV2WorkerRow>',context!);
        Heatmap = JsonConverters.fromJson(json['Heatmap'],'List<KpiV2HeatPoint>',context!);
        LiveQueue = JsonConverters.fromJson(json['LiveQueue'],'List<KpiV2LiveRow>',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!),
        'ServicesByType': JsonConverters.toJson(ServicesByType,'DashboardSeries',context!),
        'LocationLeaderboard': JsonConverters.toJson(LocationLeaderboard,'List<KpiV2LocationRow>',context!),
        'WorkerProductivity': JsonConverters.toJson(WorkerProductivity,'List<KpiV2WorkerRow>',context!),
        'Heatmap': JsonConverters.toJson(Heatmap,'List<KpiV2HeatPoint>',context!),
        'LiveQueue': JsonConverters.toJson(LiveQueue,'List<KpiV2LiveRow>',context!)
    };

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

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

    KpiV2Request({this.FromDate,this.ToDate,this.LocationIds});
    KpiV2Request.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() => "KpiV2Request";
    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>[]),
    'KpiV2LocationRow': TypeInfo(TypeOf.Class, create:() => KpiV2LocationRow()),
    'KpiV2WorkerRow': TypeInfo(TypeOf.Class, create:() => KpiV2WorkerRow()),
    'KpiV2HeatPoint': TypeInfo(TypeOf.Class, create:() => KpiV2HeatPoint()),
    'KpiV2LiveRow': TypeInfo(TypeOf.Class, create:() => KpiV2LiveRow()),
    'KpiV2Response': TypeInfo(TypeOf.Class, create:() => KpiV2Response()),
    'List<DashboardStatTile>': TypeInfo(TypeOf.Class, create:() => <DashboardStatTile>[]),
    'List<DashboardSeries>': TypeInfo(TypeOf.Class, create:() => <DashboardSeries>[]),
    'List<KpiV2LocationRow>': TypeInfo(TypeOf.Class, create:() => <KpiV2LocationRow>[]),
    'List<KpiV2WorkerRow>': TypeInfo(TypeOf.Class, create:() => <KpiV2WorkerRow>[]),
    'List<KpiV2HeatPoint>': TypeInfo(TypeOf.Class, create:() => <KpiV2HeatPoint>[]),
    'List<KpiV2LiveRow>': TypeInfo(TypeOf.Class, create:() => <KpiV2LiveRow>[]),
    'KpiV2Request': TypeInfo(TypeOf.Class, create:() => KpiV2Request()),
});

Dart KpiV2Request 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/dashboard/kpiv2 HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"FromDate":"0001-01-01T00:00:00.0000000","ToDate":"0001-01-01T00:00:00.0000000","LocationIds":["00000000000000000000000000000000"]}
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"}},"Stats":[{"Key":"String","Label":"String","Value":0,"PreviousValue":0,"Unit":"String","DeltaPct":null}],"Trend":[{"Name":"String","Points":[{"Label":"String","Value":0}]}],"ServicesByType":{"Name":"String","Points":[{"Label":"String","Value":0}]},"LocationLeaderboard":[{"LocationName":"String","Walkins":0,"Completed":0,"AvgServiceMinutes":0,"AbandonmentPct":0}],"WorkerProductivity":[{"WorkerName":"String","Completed":0,"AvgServiceMinutes":0}],"Heatmap":[{"Dow":0,"Hr":0,"Cnt":0}],"LiveQueue":[{"LocationName":"String","Waiting":0,"InProgress":0}]}