Required role: | Admin |
// @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 enum SkuType
{
Product = 'Product',
PerDev = 'PerDev',
PerCore = 'PerCore',
Site = 'Site',
Support = 'Support',
Training = 'Training',
Register = 'Register',
Payment = 'Payment',
}
export class OrderDetail
{
public id: number;
public orderId: number;
public skuId: number;
public skuType: SkuType;
public price: number;
public description: string;
public quantity: number;
public total: number;
public constructor(init?: Partial<OrderDetail>) { (Object as any).assign(this, init); }
}
export class Order implements IAddress
{
public id: number;
public customerId: number;
public productName: string;
public firstName: string;
public lastName: string;
public email: string;
public company: string;
public phoneNumber: string;
public addressLine1: string;
public addressLine2: string;
public addressCity: string;
public addressZip: string;
public addressState: string;
public addressCountry: string;
public agreeTerms: boolean;
public notes: string;
public last4: string;
public subTotal: number;
public couponId: string;
public discount: number;
public tax: number;
public total: number;
public itemQuantity: number;
public authorizedQuantity?: number;
public subscriptionId?: number;
public licenseRef: string;
public paymentId?: number;
public emailId?: number;
public paid: boolean;
public createdDate: string;
public modifiedDate: string;
public modifiedBy: string;
public cancelledDate?: string;
public cancelledReason: string;
public ipAddress: string;
public orderDetails: OrderDetail[];
public constructor(init?: Partial<Order>) { (Object as any).assign(this, init); }
}
// @ValidateRequest(Validator="IsAdmin")
export class QueryOrders extends QueryDb<Order>
{
public constructor(init?: Partial<QueryOrders>) { super(init); (Object as any).assign(this, init); }
}
export enum LicenseType
{
Free = 'Free',
FreeIndividual = 'FreeIndividual',
FreeOpenSource = 'FreeOpenSource',
Indie = 'Indie',
Business = 'Business',
Enterprise = 'Enterprise',
TextIndie = 'TextIndie',
TextBusiness = 'TextBusiness',
OrmLiteIndie = 'OrmLiteIndie',
OrmLiteBusiness = 'OrmLiteBusiness',
RedisIndie = 'RedisIndie',
RedisBusiness = 'RedisBusiness',
AwsIndie = 'AwsIndie',
AwsBusiness = 'AwsBusiness',
Trial = 'Trial',
Site = 'Site',
TextSite = 'TextSite',
RedisSite = 'RedisSite',
OrmLiteSite = 'OrmLiteSite',
}
export class LicenseKey
{
public ref: string;
public name: string;
public type: LicenseType;
public meta: number;
public hash: string;
public halg: string;
public expiry: string;
public constructor(init?: Partial<LicenseKey>) { (Object as any).assign(this, init); }
}
export class Subscription
{
public id: number;
public customerId: number;
public email: string;
public skuId: number;
public skuName: string;
public skuType: SkuType;
public code: string;
public quantity: number;
public supportQuantity: number;
public total: number;
public isPlan: boolean;
public isRenewal: boolean;
public subscriptionDurationDays: number;
public renewalDate?: string;
public licenseRef: string;
public licenseName: string;
public licenseAddress: string;
public licenseType: LicenseType;
public expiryDate: string;
public licenseKey: LicenseKey;
public licenseKeyText: string;
public createdDate: string;
public modifiedDate: string;
public cancelledDate?: string;
public stripeSubscriptionId: string;
public emailId?: number;
public emailRenewalId?: number;
public emailExpiredId?: number;
public renewalSubscriptionId?: number;
public externalRef: string;
public notes: string;
public error: string;
public constructor(init?: Partial<Subscription>) { (Object as any).assign(this, init); }
}
export class Customer implements IAddress
{
public id: number;
public email: string;
public displayName: string;
public firstName: string;
public lastName: string;
public company: string;
public phoneNumber: string;
public addressLine1: string;
public addressLine2: string;
public addressCity: string;
public addressZip: string;
public addressState: string;
public addressCountry: string;
public stripeCustomerId: string;
public stripeCouponId: string;
public plan: string;
public createdDate: string;
public isReferrer: boolean;
public orders: Order[];
public subscriptions: Subscription[];
public constructor(init?: Partial<Customer>) { (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: Customer[] = [];
// @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); }
}
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/QueryOrders HTTP/1.1
Host: account.servicestack.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
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, customerId: 0, productName: String, firstName: String, lastName: String, email: String, company: String, phoneNumber: String, addressLine1: String, addressLine2: String, addressCity: String, addressZip: String, addressState: String, addressCountry: String, agreeTerms: False, notes: String, last4: String, subTotal: 0, couponId: String, discount: 0, tax: 0, total: 0, itemQuantity: 0, authorizedQuantity: 0, subscriptionId: 0, licenseRef: String, paymentId: 0, emailId: 0, paid: False, createdDate: 0001-01-01, modifiedDate: 0001-01-01, modifiedBy: String, cancelledDate: 0001-01-01, cancelledReason: String, ipAddress: String, orderDetails: [ { id: 0, orderId: 0, skuId: 0, skuType: Product, price: 0, description: String, quantity: 0, 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 } } }