namespace ServiceStack
open System
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations
[<AllowNullLiteral>]
type GithubUser() =
member val Id:Int32 = new Int32() with get,set
member val Login:String = null with get,set
member val Avatar_Url:String = null with get,set
member val Url:String = null with get,set
member val Followers:Nullable<Int32> = new Nullable<Int32>() with get,set
member val Following:Nullable<Int32> = new Nullable<Int32>() with get,set
member val Type:String = null with get,set
member val Public_Gists:Nullable<Int32> = new Nullable<Int32>() with get,set
member val Location:String = null with get,set
member val Company:String = null with get,set
member val Html_Url:String = null with get,set
member val Public_Repos:Nullable<Int32> = new Nullable<Int32>() with get,set
member val Created_At:Nullable<DateTime> = new Nullable<DateTime>() with get,set
member val Blog:String = null with get,set
member val Email:String = null with get,set
member val Name:String = null with get,set
member val Hireable:Nullable<Boolean> = new Nullable<Boolean>() with get,set
member val Gravatar_Id:String = null with get,set
member val Bio:String = null with get,set
[<AllowNullLiteral>]
type GithubRepo() =
member val Id:Int32 = new Int32() with get,set
member val Name:String = null with get,set
member val Description:String = null with get,set
member val Homepage:String = null with get,set
member val Language:String = null with get,set
member val Watchers_Count:Int32 = new Int32() with get,set
member val Stargazes_Count:Int32 = new Int32() with get,set
member val Forks_Count:Int32 = new Int32() with get,set
member val Open_Issues_Count:Int32 = new Int32() with get,set
member val Size:Int32 = new Int32() with get,set
member val Full_Name:String = null with get,set
member val Created_at:DateTime = new DateTime() with get,set
member val Pushed_At:Nullable<DateTime> = new Nullable<DateTime>() with get,set
member val Updated_At:Nullable<DateTime> = new Nullable<DateTime>() with get,set
member val Has_issues:Boolean = new Boolean() with get,set
member val Has_Downloads:Boolean = new Boolean() with get,set
member val Has_Wiki:Boolean = new Boolean() with get,set
member val Has_Pages:Boolean = new Boolean() with get,set
member val Fork:Boolean = new Boolean() with get,set
member val Owner:GithubUser = null with get,set
member val Svn_Url:String = null with get,set
member val Mirror_Url:String = null with get,set
member val Url:String = null with get,set
member val Ssh_Url:String = null with get,set
member val Html_Url:String = null with get,set
member val Clone_Url:String = null with get,set
member val Git_Url:String = null with get,set
member val Private:Boolean = new Boolean() with get,set
[<AllowNullLiteral>]
type QueryGitHubRepos() =
inherit QueryData<GithubRepo>()
member val UserName:String = null with get,set
[<DataContract>]
[<AllowNullLiteral>]
type QueryBase() =
[<DataMember(Order=1)>]
member val Skip:Nullable<Int32> = new Nullable<Int32>() with get,set
[<DataMember(Order=2)>]
member val Take:Nullable<Int32> = new Nullable<Int32>() with get,set
[<DataMember(Order=3)>]
member val OrderBy:String = null with get,set
[<DataMember(Order=4)>]
member val OrderByDesc:String = null with get,set
[<DataMember(Order=5)>]
member val Include:String = null with get,set
[<DataMember(Order=6)>]
member val Fields:String = null with get,set
[<DataMember(Order=7)>]
member val Meta:Dictionary<String, String> = new Dictionary<String, String>() with get,set
[<AllowNullLiteral>]
type QueryData<T>() =
inherit QueryBase()
[<AllowNullLiteral>]
type Order() =
member val OrderId:Int32 = new Int32() with get,set
member val CustomerId:String = null with get,set
member val OrderDate:DateTime = new DateTime() with get,set
member val Total:Double = new Double() with get,set
[<AllowNullLiteral>]
type Customer() =
member val CustomerId:String = null with get,set
member val CompanyName:String = null with get,set
member val Address:String = null with get,set
member val City:String = null with get,set
member val Region:String = null with get,set
member val PostalCode:String = null with get,set
member val Country:String = null with get,set
member val Phone:String = null with get,set
member val Fax:String = null with get,set
member val Orders:ResizeArray<Order> = new ResizeArray<Order>() with get,set
[<DataContract>]
[<AllowNullLiteral>]
type QueryResponse<Customer>() =
[<DataMember(Order=1)>]
member val Offset:Int32 = new Int32() with get,set
[<DataMember(Order=2)>]
member val Total:Int32 = new Int32() with get,set
[<DataMember(Order=3)>]
member val Results:ResizeArray<Customer> = new ResizeArray<Customer>() with get,set
[<DataMember(Order=4)>]
member val Meta:Dictionary<String, String> = new Dictionary<String, String>() with get,set
[<DataMember(Order=5)>]
member val ResponseStatus:ResponseStatus = null with 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 } } }