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!) ?? DateTime(0);
        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 = 0;

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

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'] ?? 0;
        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!) ?? DateTime(0);
        createdBy = json['createdBy'] ?? "";
        modifiedDate = JsonConverters.fromJson(json['modifiedDate'],'DateTime',context!) ?? DateTime(0);
        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 = 0;
    int id = 0;
    String firstName = "";
    String lastName = "";
    int? age;
    DateTime? dateOfBirth;
    DateTime? dateDied;
    LivingStatus? livingStatus;

    RockstarAuditTenant({this.tenantId=0,this.id=0,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'] ?? 0;
        id = json['id'] ?? 0;
        firstName = json['firstName'] ?? "";
        lastName = json['lastName'] ?? "";
        age = json['age'];
        dateOfBirth = JsonConverters.fromJson(json['dateOfBirth'],'DateTime',context!) ?? DateTime(0);
        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<T> implements IConvertible
{
    // @DataMember(Order=1)
    int offset = 0;

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

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

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

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

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

    fromMap(Map<String, dynamic> json) {
        offset = json['offset'] ?? 0;
        total = json['total'] ?? 0;
        results = JsonConverters.fromJson(json['results'],'List<Poco>',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<$T>";
    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()),
    'List<Poco>': TypeInfo(TypeOf.Class, create:() => <Poco>[]),
});

Dart QueryRockstarAuditSubOr 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 /xml/reply/QueryRockstarAuditSubOr HTTP/1.1 
Host: test.servicestack.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<QueryRockstarAuditSubOr xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Test.ServiceModel">
  <Skip xmlns="http://schemas.servicestack.net/types">0</Skip>
  <Take xmlns="http://schemas.servicestack.net/types">0</Take>
  <OrderBy xmlns="http://schemas.servicestack.net/types">String</OrderBy>
  <OrderByDesc xmlns="http://schemas.servicestack.net/types">String</OrderByDesc>
  <Include xmlns="http://schemas.servicestack.net/types">String</Include>
  <Fields xmlns="http://schemas.servicestack.net/types">String</Fields>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.servicestack.net/types">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <AgeOlderThan>0</AgeOlderThan>
  <FirstNameStartsWith>String</FirstNameStartsWith>
</QueryRockstarAuditSubOr>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QueryResponseOfRockstarAutop_S_PBaRK1 xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Offset>0</Offset>
  <Total>0</Total>
  <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/Test.ServiceModel">
    <d2p1:RockstarAuto>
      <d2p1:Age>0</d2p1:Age>
      <d2p1:DateDied>0001-01-01T00:00:00</d2p1:DateDied>
      <d2p1:DateOfBirth>0001-01-01T00:00:00</d2p1:DateOfBirth>
      <d2p1:FirstName>String</d2p1:FirstName>
      <d2p1:LastName>String</d2p1:LastName>
      <d2p1:LivingStatus>Alive</d2p1:LivingStatus>
      <d2p1:Id>0</d2p1:Id>
    </d2p1:RockstarAuto>
  </Results>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <ResponseStatus>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StackTrace>String</StackTrace>
    <Errors>
      <ResponseError>
        <ErrorCode>String</ErrorCode>
        <FieldName>String</FieldName>
        <Message>String</Message>
        <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>
        </Meta>
      </ResponseError>
    </Errors>
    <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>
    </Meta>
  </ResponseStatus>
</QueryResponseOfRockstarAutop_S_PBaRK1>