using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using SharpScript;
namespace ServiceStack
{
[DataContract]
public partial class QueryBase
{
public QueryBase()
{
Meta = new Dictionary<string, string>{};
}
[DataMember(Order=1)]
public virtual int? Skip { get; set; }
[DataMember(Order=2)]
public virtual int? Take { get; set; }
[DataMember(Order=3)]
public virtual string OrderBy { get; set; }
[DataMember(Order=4)]
public virtual string OrderByDesc { get; set; }
[DataMember(Order=5)]
public virtual string Include { get; set; }
[DataMember(Order=6)]
public virtual string Fields { get; set; }
[DataMember(Order=7)]
public virtual Dictionary<string, string> Meta { get; set; }
}
public partial class QueryData<T>
: QueryBase
{
}
[DataContract]
public partial class QueryResponse<Customer>
{
public QueryResponse()
{
Results = new List<Customer>{};
Meta = new Dictionary<string, string>{};
}
[DataMember(Order=1)]
public virtual int Offset { get; set; }
[DataMember(Order=2)]
public virtual int Total { get; set; }
[DataMember(Order=3)]
public virtual List<Customer> Results { get; set; }
[DataMember(Order=4)]
public virtual Dictionary<string, string> Meta { get; set; }
[DataMember(Order=5)]
public virtual ResponseStatus ResponseStatus { get; set; }
}
}
namespace SharpScript
{
public partial class Customer
{
public Customer()
{
Orders = new List<Order>{};
}
public virtual string CustomerId { get; set; }
public virtual string CompanyName { get; set; }
public virtual string Address { get; set; }
public virtual string City { get; set; }
public virtual string Region { get; set; }
public virtual string PostalCode { get; set; }
public virtual string Country { get; set; }
public virtual string Phone { get; set; }
public virtual string Fax { get; set; }
public virtual List<Order> Orders { get; set; }
}
public partial class GithubRepo
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual string Homepage { get; set; }
public virtual string Language { get; set; }
public virtual int Watchers_Count { get; set; }
public virtual int Stargazes_Count { get; set; }
public virtual int Forks_Count { get; set; }
public virtual int Open_Issues_Count { get; set; }
public virtual int Size { get; set; }
public virtual string Full_Name { get; set; }
public virtual DateTime Created_at { get; set; }
public virtual DateTime? Pushed_At { get; set; }
public virtual DateTime? Updated_At { get; set; }
public virtual bool Has_issues { get; set; }
public virtual bool Has_Downloads { get; set; }
public virtual bool Has_Wiki { get; set; }
public virtual bool Has_Pages { get; set; }
public virtual bool Fork { get; set; }
public virtual GithubUser Owner { get; set; }
public virtual string Svn_Url { get; set; }
public virtual string Mirror_Url { get; set; }
public virtual string Url { get; set; }
public virtual string Ssh_Url { get; set; }
public virtual string Html_Url { get; set; }
public virtual string Clone_Url { get; set; }
public virtual string Git_Url { get; set; }
public virtual bool Private { get; set; }
}
public partial class GithubUser
{
public virtual int Id { get; set; }
public virtual string Login { get; set; }
public virtual string Avatar_Url { get; set; }
public virtual string Url { get; set; }
public virtual int? Followers { get; set; }
public virtual int? Following { get; set; }
public virtual string Type { get; set; }
public virtual int? Public_Gists { get; set; }
public virtual string Location { get; set; }
public virtual string Company { get; set; }
public virtual string Html_Url { get; set; }
public virtual int? Public_Repos { get; set; }
public virtual DateTime? Created_At { get; set; }
public virtual string Blog { get; set; }
public virtual string Email { get; set; }
public virtual string Name { get; set; }
public virtual bool? Hireable { get; set; }
public virtual string Gravatar_Id { get; set; }
public virtual string Bio { get; set; }
}
public partial class Order
{
public virtual int OrderId { get; set; }
public virtual string CustomerId { get; set; }
public virtual DateTime OrderDate { get; set; }
public virtual double Total { get; set; }
}
public partial class QueryGitHubRepos
: QueryData<GithubRepo>
{
public virtual string UserName { get; set; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsv/reply/QueryGitHubRepos HTTP/1.1
Host: sharpscript.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
userName: String,
skip: 0,
take: 0,
orderBy: String,
orderByDesc: String,
include: String,
fields: String,
meta:
{
String: String
}
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { offset: 0, total: 0, results: [ { id: 0, name: String, description: String, homepage: String, language: String, watchers_Count: 0, stargazes_Count: 0, forks_Count: 0, open_Issues_Count: 0, size: 0, full_Name: String, created_at: 0001-01-01, pushed_At: 0001-01-01, updated_At: 0001-01-01, has_issues: False, has_Downloads: False, has_Wiki: False, has_Pages: False, fork: False, owner: { id: 0, login: String, avatar_Url: String, url: String, followers: 0, following: 0, type: String, public_Gists: 0, location: String, company: String, html_Url: String, public_Repos: 0, created_At: 0001-01-01, blog: String, email: String, name: String, hireable: False, gravatar_Id: String, bio: String }, svn_Url: String, mirror_Url: String, url: String, ssh_Url: String, html_Url: String, clone_Url: String, git_Url: String, private: False } ], meta: { String: String }, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } } }