Test

<back to all web services

QueryRockstarAuditSubOr

import 'package:servicestack/servicestack.dart';

// @DataContract
abstract class QueryBase
{
    // @DataMember(Order=1)
    int? skip;

    // @DataMember(Order=2)
    int? take;

    // @DataMember(Order=3)
    String? orderBy;

    // @DataMember(Order=4)
    String? orderByDesc;

    // @DataMember(Order=5)
    String? include;

    // @DataMember(Order=6)
    String? fields;

    // @DataMember(Order=7)
    Map<String,String?>? meta;

    QueryBase({this.skip,this.take,this.orderBy,this.orderByDesc,this.include,this.fields,this.meta});
    QueryBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        skip = json['skip'];
        take = json['take'];
        orderBy = json['orderBy'];
        orderByDesc = json['orderByDesc'];
        include = json['include'];
        fields = json['fields'];
        meta = JsonConverters.toStringMap(json['meta']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'skip': skip,
        'take': take,
        'orderBy': orderBy,
        'orderByDesc': orderByDesc,
        'include': include,
        'fields': fields,
        'meta': meta
    };

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

abstract class QueryDb2<From,Into> extends QueryBase
{
    QueryDb2();
    QueryDb2.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "QueryDb<$From,$Into>";
    TypeContext? context = _ctx;
}

enum LivingStatus
{
    Alive,
    Dead,
}

abstract class RockstarBase
{
    String? firstName;
    String? lastName;
    int? age;
    DateTime? dateOfBirth;
    DateTime? dateDied;
    LivingStatus? livingStatus;

    RockstarBase({this.firstName,this.lastName,this.age,this.dateOfBirth,this.dateDied,this.livingStatus});
    RockstarBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        firstName = json['firstName'];
        lastName = json['lastName'];
        age = json['age'];
        dateOfBirth = JsonConverters.fromJson(json['dateOfBirth'],'DateTime',context!);
        dateDied = JsonConverters.fromJson(json['dateDied'],'DateTime',context!);
        livingStatus = JsonConverters.fromJson(json['livingStatus'],'LivingStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'firstName': firstName,
        'lastName': lastName,
        'age': age,
        'dateOfBirth': JsonConverters.toJson(dateOfBirth,'DateTime',context!),
        'dateDied': JsonConverters.toJson(dateDied,'DateTime',context!),
        'livingStatus': JsonConverters.toJson(livingStatus,'LivingStatus',context!)
    };

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

class RockstarAuto extends RockstarBase implements IConvertible
{
    int? id;

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

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

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id
    });

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

// @DataContract
abstract class AuditBase
{
    // @DataMember(Order=1)
    DateTime? createdDate;

    // @DataMember(Order=2)
    // @required()
    String? createdBy;

    // @DataMember(Order=3)
    DateTime? modifiedDate;

    // @DataMember(Order=4)
    // @required()
    String? modifiedBy;

    // @DataMember(Order=5)
    DateTime? deletedDate;

    // @DataMember(Order=6)
    String? deletedBy;

    AuditBase({this.createdDate,this.createdBy,this.modifiedDate,this.modifiedBy,this.deletedDate,this.deletedBy});
    AuditBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
        createdBy = json['createdBy'];
        modifiedDate = JsonConverters.fromJson(json['modifiedDate'],'DateTime',context!);
        modifiedBy = json['modifiedBy'];
        deletedDate = JsonConverters.fromJson(json['deletedDate'],'DateTime',context!);
        deletedBy = json['deletedBy'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!),
        'createdBy': createdBy,
        'modifiedDate': JsonConverters.toJson(modifiedDate,'DateTime',context!),
        'modifiedBy': modifiedBy,
        'deletedDate': JsonConverters.toJson(deletedDate,'DateTime',context!),
        'deletedBy': deletedBy
    };

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

class RockstarAuditTenant extends AuditBase implements IConvertible
{
    int? tenantId;
    int? id;
    String? firstName;
    String? lastName;
    int? age;
    DateTime? dateOfBirth;
    DateTime? dateDied;
    LivingStatus? livingStatus;

    RockstarAuditTenant({this.tenantId,this.id,this.firstName,this.lastName,this.age,this.dateOfBirth,this.dateDied,this.livingStatus});
    RockstarAuditTenant.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        tenantId = json['tenantId'];
        id = json['id'];
        firstName = json['firstName'];
        lastName = json['lastName'];
        age = json['age'];
        dateOfBirth = JsonConverters.fromJson(json['dateOfBirth'],'DateTime',context!);
        dateDied = JsonConverters.fromJson(json['dateDied'],'DateTime',context!);
        livingStatus = JsonConverters.fromJson(json['livingStatus'],'LivingStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'tenantId': tenantId,
        'id': id,
        'firstName': firstName,
        'lastName': lastName,
        'age': age,
        'dateOfBirth': JsonConverters.toJson(dateOfBirth,'DateTime',context!),
        'dateDied': JsonConverters.toJson(dateDied,'DateTime',context!),
        'livingStatus': JsonConverters.toJson(livingStatus,'LivingStatus',context!)
    });

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

class QueryRockstarAuditSubOr extends QueryDb2<RockstarAuditTenant,RockstarAuto> implements IConvertible
{
    String? firstNameStartsWith;
    int? ageOlderThan;

    QueryRockstarAuditSubOr({this.firstNameStartsWith,this.ageOlderThan});
    QueryRockstarAuditSubOr.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        firstNameStartsWith = json['firstNameStartsWith'];
        ageOlderThan = json['ageOlderThan'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'firstNameStartsWith': firstNameStartsWith,
        'ageOlderThan': ageOlderThan
    });

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

class Poco implements IConvertible
{
    String? name;

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

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

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

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

// @DataContract
class QueryResponse<Poco> implements IConvertible
{
    // @DataMember(Order=1)
    int? offset;

    // @DataMember(Order=2)
    int? total;

    // @DataMember(Order=3)
    List<Poco>? results;

    // @DataMember(Order=4)
    Map<String,String?>? meta;

    // @DataMember(Order=5)
    ResponseStatus? responseStatus;

    QueryResponse({this.offset,this.total,this.results,this.meta,this.responseStatus});
    QueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        offset = json['offset'];
        total = json['total'];
        results = JsonConverters.fromJson(json['results'],'List<${runtimeGenericTypeDefs(this,[0]).join(",")}>',context!);
        meta = JsonConverters.toStringMap(json['meta']);
        responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'offset': offset,
        'total': total,
        'results': JsonConverters.toJson(results,'List<Poco>',context!),
        'meta': meta,
        'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "QueryResponse<$Poco>";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'test.servicestack.net', types: <String, TypeInfo> {
    'LivingStatus': TypeInfo(TypeOf.Enum, enumValues:LivingStatus.values),
    'RockstarBase': TypeInfo(TypeOf.AbstractClass),
    'RockstarAuto': TypeInfo(TypeOf.Class, create:() => RockstarAuto()),
    'RockstarAuditTenant': TypeInfo(TypeOf.Class, create:() => RockstarAuditTenant()),
    'QueryRockstarAuditSubOr': TypeInfo(TypeOf.Class, create:() => QueryRockstarAuditSubOr()),
    'List<RockstarAuto>': TypeInfo(TypeOf.Class, create:() => <RockstarAuto>[]),
    'Poco': TypeInfo(TypeOf.Class, create:() => Poco()),
    'QueryResponse<Poco>': TypeInfo(TypeOf.Class, create:() => QueryResponse<Poco>()),
});

Dart QueryRockstarAuditSubOr 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.

POST /csv/reply/QueryRockstarAuditSubOr HTTP/1.1 
Host: test.servicestack.net 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"firstNameStartsWith":"String","ageOlderThan":0,"skip":0,"take":0,"orderBy":"String","orderByDesc":"String","include":"String","fields":"String","meta":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"offset":0,"total":0,"results":[{"id":0,"firstName":"String","lastName":"String","age":0,"dateOfBirth":"\/Date(-62135596800000-0000)\/","dateDied":"\/Date(-62135596800000-0000)\/","livingStatus":"Alive"}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}