#Script Pages

<back to all web services

QueryGitHubRepos

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 QueryData<T> extends QueryBase
{
    QueryData();
    QueryData.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() => "QueryData<$T>";
    TypeContext? context = _ctx;
}

class GithubUser implements IConvertible
{
    int? id;
    String? login;
    String? avatar_Url;
    String? url;
    int? followers;
    int? following;
    String? type;
    int? public_Gists;
    String? location;
    String? company;
    String? html_Url;
    int? public_Repos;
    DateTime? created_At;
    String? blog;
    String? email;
    String? name;
    bool? hireable;
    String? gravatar_Id;
    String? bio;

    GithubUser({this.id,this.login,this.avatar_Url,this.url,this.followers,this.following,this.type,this.public_Gists,this.location,this.company,this.html_Url,this.public_Repos,this.created_At,this.blog,this.email,this.name,this.hireable,this.gravatar_Id,this.bio});
    GithubUser.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        login = json['login'];
        avatar_Url = json['avatar_Url'];
        url = json['url'];
        followers = json['followers'];
        following = json['following'];
        type = json['type'];
        public_Gists = json['public_Gists'];
        location = json['location'];
        company = json['company'];
        html_Url = json['html_Url'];
        public_Repos = json['public_Repos'];
        created_At = JsonConverters.fromJson(json['created_At'],'DateTime',context!);
        blog = json['blog'];
        email = json['email'];
        name = json['name'];
        hireable = json['hireable'];
        gravatar_Id = json['gravatar_Id'];
        bio = json['bio'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'login': login,
        'avatar_Url': avatar_Url,
        'url': url,
        'followers': followers,
        'following': following,
        'type': type,
        'public_Gists': public_Gists,
        'location': location,
        'company': company,
        'html_Url': html_Url,
        'public_Repos': public_Repos,
        'created_At': JsonConverters.toJson(created_At,'DateTime',context!),
        'blog': blog,
        'email': email,
        'name': name,
        'hireable': hireable,
        'gravatar_Id': gravatar_Id,
        'bio': bio
    };

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

class GithubRepo implements IConvertible
{
    int? id;
    String? name;
    String? description;
    String? homepage;
    String? language;
    int? watchers_Count;
    int? stargazes_Count;
    int? forks_Count;
    int? open_Issues_Count;
    int? size;
    String? full_Name;
    DateTime? created_at;
    DateTime? pushed_At;
    DateTime? updated_At;
    bool? has_issues;
    bool? has_Downloads;
    bool? has_Wiki;
    bool? has_Pages;
    bool? fork;
    GithubUser? owner;
    String? svn_Url;
    String? mirror_Url;
    String? url;
    String? ssh_Url;
    String? html_Url;
    String? clone_Url;
    String? git_Url;
    bool? private;

    GithubRepo({this.id,this.name,this.description,this.homepage,this.language,this.watchers_Count,this.stargazes_Count,this.forks_Count,this.open_Issues_Count,this.size,this.full_Name,this.created_at,this.pushed_At,this.updated_At,this.has_issues,this.has_Downloads,this.has_Wiki,this.has_Pages,this.fork,this.owner,this.svn_Url,this.mirror_Url,this.url,this.ssh_Url,this.html_Url,this.clone_Url,this.git_Url,this.private});
    GithubRepo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        description = json['description'];
        homepage = json['homepage'];
        language = json['language'];
        watchers_Count = json['watchers_Count'];
        stargazes_Count = json['stargazes_Count'];
        forks_Count = json['forks_Count'];
        open_Issues_Count = json['open_Issues_Count'];
        size = json['size'];
        full_Name = json['full_Name'];
        created_at = JsonConverters.fromJson(json['created_at'],'DateTime',context!);
        pushed_At = JsonConverters.fromJson(json['pushed_At'],'DateTime',context!);
        updated_At = JsonConverters.fromJson(json['updated_At'],'DateTime',context!);
        has_issues = json['has_issues'];
        has_Downloads = json['has_Downloads'];
        has_Wiki = json['has_Wiki'];
        has_Pages = json['has_Pages'];
        fork = json['fork'];
        owner = JsonConverters.fromJson(json['owner'],'GithubUser',context!);
        svn_Url = json['svn_Url'];
        mirror_Url = json['mirror_Url'];
        url = json['url'];
        ssh_Url = json['ssh_Url'];
        html_Url = json['html_Url'];
        clone_Url = json['clone_Url'];
        git_Url = json['git_Url'];
        private = json['private'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'description': description,
        'homepage': homepage,
        'language': language,
        'watchers_Count': watchers_Count,
        'stargazes_Count': stargazes_Count,
        'forks_Count': forks_Count,
        'open_Issues_Count': open_Issues_Count,
        'size': size,
        'full_Name': full_Name,
        'created_at': JsonConverters.toJson(created_at,'DateTime',context!),
        'pushed_At': JsonConverters.toJson(pushed_At,'DateTime',context!),
        'updated_At': JsonConverters.toJson(updated_At,'DateTime',context!),
        'has_issues': has_issues,
        'has_Downloads': has_Downloads,
        'has_Wiki': has_Wiki,
        'has_Pages': has_Pages,
        'fork': fork,
        'owner': JsonConverters.toJson(owner,'GithubUser',context!),
        'svn_Url': svn_Url,
        'mirror_Url': mirror_Url,
        'url': url,
        'ssh_Url': ssh_Url,
        'html_Url': html_Url,
        'clone_Url': clone_Url,
        'git_Url': git_Url,
        'private': private
    };

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

class QueryGitHubRepos extends QueryData<GithubRepo> implements IConvertible
{
    String? userName;

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

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

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

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

class Order implements IConvertible
{
    int? orderId;
    String? customerId;
    DateTime? orderDate;
    double? total;

    Order({this.orderId,this.customerId,this.orderDate,this.total});
    Order.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        orderId = json['orderId'];
        customerId = json['customerId'];
        orderDate = JsonConverters.fromJson(json['orderDate'],'DateTime',context!);
        total = JsonConverters.toDouble(json['total']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'orderId': orderId,
        'customerId': customerId,
        'orderDate': JsonConverters.toJson(orderDate,'DateTime',context!),
        'total': total
    };

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

class Customer implements IConvertible
{
    String? customerId;
    String? companyName;
    String? address;
    String? city;
    String? region;
    String? postalCode;
    String? country;
    String? phone;
    String? fax;
    List<Order>? orders;

    Customer({this.customerId,this.companyName,this.address,this.city,this.region,this.postalCode,this.country,this.phone,this.fax,this.orders});
    Customer.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        customerId = json['customerId'];
        companyName = json['companyName'];
        address = json['address'];
        city = json['city'];
        region = json['region'];
        postalCode = json['postalCode'];
        country = json['country'];
        phone = json['phone'];
        fax = json['fax'];
        orders = JsonConverters.fromJson(json['orders'],'List<Order>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'customerId': customerId,
        'companyName': companyName,
        'address': address,
        'city': city,
        'region': region,
        'postalCode': postalCode,
        'country': country,
        'phone': phone,
        'fax': fax,
        'orders': JsonConverters.toJson(orders,'List<Order>',context!)
    };

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

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

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

    // @DataMember(Order=3)
    List<Customer>? 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<Customer>',context!),
        'meta': meta,
        'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'sharpscript.net', types: <String, TypeInfo> {
    'GithubUser': TypeInfo(TypeOf.Class, create:() => GithubUser()),
    'GithubRepo': TypeInfo(TypeOf.Class, create:() => GithubRepo()),
    'QueryGitHubRepos': TypeInfo(TypeOf.Class, create:() => QueryGitHubRepos()),
    'List<GithubRepo>': TypeInfo(TypeOf.Class, create:() => <GithubRepo>[]),
    'Order': TypeInfo(TypeOf.Class, create:() => Order()),
    'Customer': TypeInfo(TypeOf.Class, create:() => Customer()),
    'List<Order>': TypeInfo(TypeOf.Class, create:() => <Order>[]),
    'QueryResponse<Customer>': TypeInfo(TypeOf.Class, create:() => QueryResponse<Customer>()),
});

Dart QueryGitHubRepos 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/QueryGitHubRepos HTTP/1.1 
Host: sharpscript.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<QueryGitHubRepos xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SharpScript">
  <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>
  <UserName>String</UserName>
</QueryGitHubRepos>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QueryResponseOfGithubRepoA703xr44 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/SharpScript">
    <d2p1:GithubRepo>
      <d2p1:Clone_Url>String</d2p1:Clone_Url>
      <d2p1:Created_at>0001-01-01T00:00:00</d2p1:Created_at>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:Fork>false</d2p1:Fork>
      <d2p1:Forks_Count>0</d2p1:Forks_Count>
      <d2p1:Full_Name>String</d2p1:Full_Name>
      <d2p1:Git_Url>String</d2p1:Git_Url>
      <d2p1:Has_Downloads>false</d2p1:Has_Downloads>
      <d2p1:Has_Pages>false</d2p1:Has_Pages>
      <d2p1:Has_Wiki>false</d2p1:Has_Wiki>
      <d2p1:Has_issues>false</d2p1:Has_issues>
      <d2p1:Homepage>String</d2p1:Homepage>
      <d2p1:Html_Url>String</d2p1:Html_Url>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:Language>String</d2p1:Language>
      <d2p1:Mirror_Url>String</d2p1:Mirror_Url>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:Open_Issues_Count>0</d2p1:Open_Issues_Count>
      <d2p1:Owner>
        <d2p1:Avatar_Url>String</d2p1:Avatar_Url>
        <d2p1:Bio>String</d2p1:Bio>
        <d2p1:Blog>String</d2p1:Blog>
        <d2p1:Company>String</d2p1:Company>
        <d2p1:Created_At>0001-01-01T00:00:00</d2p1:Created_At>
        <d2p1:Email>String</d2p1:Email>
        <d2p1:Followers>0</d2p1:Followers>
        <d2p1:Following>0</d2p1:Following>
        <d2p1:Gravatar_Id>String</d2p1:Gravatar_Id>
        <d2p1:Hireable>false</d2p1:Hireable>
        <d2p1:Html_Url>String</d2p1:Html_Url>
        <d2p1:Id>0</d2p1:Id>
        <d2p1:Location>String</d2p1:Location>
        <d2p1:Login>String</d2p1:Login>
        <d2p1:Name>String</d2p1:Name>
        <d2p1:Public_Gists>0</d2p1:Public_Gists>
        <d2p1:Public_Repos>0</d2p1:Public_Repos>
        <d2p1:Type>String</d2p1:Type>
        <d2p1:Url>String</d2p1:Url>
      </d2p1:Owner>
      <d2p1:Private>false</d2p1:Private>
      <d2p1:Pushed_At>0001-01-01T00:00:00</d2p1:Pushed_At>
      <d2p1:Size>0</d2p1:Size>
      <d2p1:Ssh_Url>String</d2p1:Ssh_Url>
      <d2p1:Stargazes_Count>0</d2p1:Stargazes_Count>
      <d2p1:Svn_Url>String</d2p1:Svn_Url>
      <d2p1:Updated_At>0001-01-01T00:00:00</d2p1:Updated_At>
      <d2p1:Url>String</d2p1:Url>
      <d2p1:Watchers_Count>0</d2p1:Watchers_Count>
    </d2p1:GithubRepo>
  </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>
</QueryResponseOfGithubRepoA703xr44>