// @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 QueryDb<T> extends QueryBase
{
public constructor(init?: Partial<QueryDb<T>>) { 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); }
}
export class QueryCustomers extends QueryDb<Customer>
{
public customerId: string;
public companyNameContains: string;
public countryIn: string[];
public constructor(init?: Partial<QueryCustomers>) { 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); }
}
// @DataContract
export class QueryResponse<T>
{
// @DataMember(Order=1)
public offset: number;
// @DataMember(Order=2)
public total: number;
// @DataMember(Order=3)
public results: GithubRepo[];
// @DataMember(Order=4)
public meta: { [index:string]: string; };
// @DataMember(Order=5)
public responseStatus: ResponseStatus;
public constructor(init?: Partial<QueryResponse<T>>) { (Object as any).assign(this, init); }
}
TypeScript QueryCustomers 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/QueryCustomers HTTP/1.1
Host: sharpscript.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
customerId: String,
companyNameContains: String,
countryIn:
[
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: [ { customerId: String, companyName: String, address: String, city: String, region: String, postalCode: String, country: String, phone: String, fax: String, orders: [ { orderId: 0, customerId: String, orderDate: 0001-01-01, total: 0 } ] } ], meta: { String: String }, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } } }