Trendsic Platform Service

<back to all web services

MaterialShortfallsRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/projects/{ProjectID}/material-shortfalls
import 'package:servicestack/servicestack.dart';

class MaterialShortfall implements IConvertible
{
    int? MaterialID;
    String? Name;
    String? MaterialType;
    double? OnHand;
    double? QtyNeeded;
    double? ShortQty;
    String? Unit;
    double? UnitPrice;
    double? EstUSD;
    String? Vendor;
    DateTime? JobStartDate;

    MaterialShortfall({this.MaterialID,this.Name,this.MaterialType,this.OnHand,this.QtyNeeded,this.ShortQty,this.Unit,this.UnitPrice,this.EstUSD,this.Vendor,this.JobStartDate});
    MaterialShortfall.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        MaterialID = json['MaterialID'];
        Name = json['Name'];
        MaterialType = json['MaterialType'];
        OnHand = JsonConverters.toDouble(json['OnHand']);
        QtyNeeded = JsonConverters.toDouble(json['QtyNeeded']);
        ShortQty = JsonConverters.toDouble(json['ShortQty']);
        Unit = json['Unit'];
        UnitPrice = JsonConverters.toDouble(json['UnitPrice']);
        EstUSD = JsonConverters.toDouble(json['EstUSD']);
        Vendor = json['Vendor'];
        JobStartDate = JsonConverters.fromJson(json['JobStartDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'MaterialID': MaterialID,
        'Name': Name,
        'MaterialType': MaterialType,
        'OnHand': OnHand,
        'QtyNeeded': QtyNeeded,
        'ShortQty': ShortQty,
        'Unit': Unit,
        'UnitPrice': UnitPrice,
        'EstUSD': EstUSD,
        'Vendor': Vendor,
        'JobStartDate': JsonConverters.toJson(JobStartDate,'DateTime',context!)
    };

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

class MaterialShortfallsResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    int? ProjectID;
    List<MaterialShortfall>? Shortfalls = [];

    MaterialShortfallsResponse({this.ResponseStatus,this.ProjectID,this.Shortfalls});
    MaterialShortfallsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        ProjectID = json['ProjectID'];
        Shortfalls = JsonConverters.fromJson(json['Shortfalls'],'List<MaterialShortfall>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
        'ProjectID': ProjectID,
        'Shortfalls': JsonConverters.toJson(Shortfalls,'List<MaterialShortfall>',context!)
    };

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

class MaterialShortfallsRequest implements IConvertible
{
    int? ProjectID;

    MaterialShortfallsRequest({this.ProjectID});
    MaterialShortfallsRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'MaterialShortfall': TypeInfo(TypeOf.Class, create:() => MaterialShortfall()),
    'MaterialShortfallsResponse': TypeInfo(TypeOf.Class, create:() => MaterialShortfallsResponse()),
    'List<MaterialShortfall>': TypeInfo(TypeOf.Class, create:() => <MaterialShortfall>[]),
    'MaterialShortfallsRequest': TypeInfo(TypeOf.Class, create:() => MaterialShortfallsRequest()),
});

Dart MaterialShortfallsRequest DTOs

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

HTTP + CSV

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

GET /v1/projects/{ProjectID}/material-shortfalls HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"ProjectID":0,"Shortfalls":[{"MaterialID":0,"Name":"String","MaterialType":"String","OnHand":0,"QtyNeeded":0,"ShortQty":0,"Unit":"String","UnitPrice":0,"EstUSD":0,"Vendor":"String","JobStartDate":"0001-01-01T00:00:00.0000000"}]}