// @DataContract
export class QueryBase
{
// @DataMember(Order=1)
public skip?: number;
// @DataMember(Order=2)
public take?: number;
// @DataMember(Order=3)
public orderBy: string;
// @DataMember(Order=4)
public orderByDesc: string;
// @DataMember(Order=5)
public include: string;
// @DataMember(Order=6)
public fields: string;
// @DataMember(Order=7)
public meta: { [index: string]: string; };
public constructor(init?: Partial<QueryBase>) { (Object as any).assign(this, init); }
}
export class QueryData<T> extends QueryBase
{
public constructor(init?: Partial<QueryData<T>>) { super(init); (Object as any).assign(this, init); }
}
export class GithubUser
{
public id: number;
public login: string;
public avatar_Url: string;
public url: string;
public followers?: number;
public following?: number;
public type: string;
public public_Gists?: number;
public location: string;
public company: string;
public html_Url: string;
public public_Repos?: number;
public created_At?: string;
public blog: string;
public email: string;
public name: string;
public hireable?: boolean;
public gravatar_Id: string;
public bio: string;
public constructor(init?: Partial<GithubUser>) { (Object as any).assign(this, init); }
}
export class GithubRepo
{
public id: number;
public name: string;
public description: string;
public homepage: string;
public language: string;
public watchers_Count: number;
public stargazes_Count: number;
public forks_Count: number;
public open_Issues_Count: number;
public size: number;
public full_Name: string;
public created_at: string;
public pushed_At?: string;
public updated_At?: string;
public has_issues: boolean;
public has_Downloads: boolean;
public has_Wiki: boolean;
public has_Pages: boolean;
public fork: boolean;
public owner: GithubUser;
public svn_Url: string;
public mirror_Url: string;
public url: string;
public ssh_Url: string;
public html_Url: string;
public clone_Url: string;
public git_Url: string;
public private: boolean;
public constructor(init?: Partial<GithubRepo>) { (Object as any).assign(this, init); }
}
export class QueryGitHubRepos extends QueryData<GithubRepo>
{
public userName: string;
public constructor(init?: Partial<QueryGitHubRepos>) { super(init); (Object as any).assign(this, init); }
}
export class Order
{
public orderId: number;
public customerId: string;
public orderDate: string;
public total: number;
public constructor(init?: Partial<Order>) { (Object as any).assign(this, init); }
}
export class Customer
{
public customerId: string;
public companyName: string;
public address: string;
public city: string;
public region: string;
public postalCode: string;
public country: string;
public phone: string;
public fax: string;
public orders: Order[];
public constructor(init?: Partial<Customer>) { (Object as any).assign(this, init); }
}
// @DataContract
export class QueryResponse<Customer>
{
// @DataMember(Order=1)
public offset: number;
// @DataMember(Order=2)
public total: number;
// @DataMember(Order=3)
public results: Customer[];
// @DataMember(Order=4)
public meta: { [index: string]: string; };
// @DataMember(Order=5)
public responseStatus: ResponseStatus;
public constructor(init?: Partial<QueryResponse<Customer>>) { (Object as any).assign(this, init); }
}
TypeScript QueryGitHubRepos DTOs
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 } } }