Required role: | Admin |
All Verbs | /query/subscriptions |
---|
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using MyApp.ServiceInterface;
using MyApp.ServiceModel;
namespace MyApp.ServiceInterface
{
[ValidateRequest("IsAdmin")]
[AutoQueryViewer(DefaultSearchField="Email", DefaultSearchType="Contains", IconUrl="material-icons:person_outline", Title="Subscriptions")]
public partial class QuerySubscriptions
: QueryDb<Subscription>
{
}
}
namespace MyApp.ServiceModel
{
public partial class Customer
: IAddress
{
public virtual int Id { get; set; }
public virtual string Email { get; set; }
public virtual string DisplayName { get; set; }
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
public virtual string Company { get; set; }
public virtual string PhoneNumber { get; set; }
public virtual string AddressLine1 { get; set; }
public virtual string AddressLine2 { get; set; }
public virtual string AddressCity { get; set; }
public virtual string AddressZip { get; set; }
public virtual string AddressState { get; set; }
public virtual string AddressCountry { get; set; }
public virtual string StripeCustomerId { get; set; }
public virtual string StripeCouponId { get; set; }
public virtual string Plan { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual bool IsReferrer { get; set; }
public virtual List<Order> Orders { get; set; }
public virtual List<Subscription> Subscriptions { get; set; }
}
public partial class Order
: IAddress
{
public virtual int Id { get; set; }
public virtual int CustomerId { get; set; }
public virtual string ProductName { get; set; }
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
public virtual string Email { get; set; }
public virtual string Company { get; set; }
public virtual string PhoneNumber { get; set; }
public virtual string AddressLine1 { get; set; }
public virtual string AddressLine2 { get; set; }
public virtual string AddressCity { get; set; }
public virtual string AddressZip { get; set; }
public virtual string AddressState { get; set; }
public virtual string AddressCountry { get; set; }
public virtual bool AgreeTerms { get; set; }
public virtual string Notes { get; set; }
public virtual string Last4 { get; set; }
public virtual int SubTotal { get; set; }
public virtual string CouponId { get; set; }
public virtual int Discount { get; set; }
public virtual int Tax { get; set; }
public virtual int Total { get; set; }
public virtual int ItemQuantity { get; set; }
public virtual int? AuthorizedQuantity { get; set; }
public virtual int? SubscriptionId { get; set; }
public virtual string LicenseRef { get; set; }
public virtual int? PaymentId { get; set; }
public virtual int? EmailId { get; set; }
public virtual bool Paid { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual DateTime ModifiedDate { get; set; }
public virtual string ModifiedBy { get; set; }
public virtual DateTime? CancelledDate { get; set; }
public virtual string CancelledReason { get; set; }
public virtual string IpAddress { get; set; }
public virtual List<OrderDetail> OrderDetails { get; set; }
}
public partial class OrderDetail
{
public virtual int Id { get; set; }
public virtual int OrderId { get; set; }
public virtual int SkuId { get; set; }
public virtual SkuType SkuType { get; set; }
public virtual int Price { get; set; }
public virtual string Description { get; set; }
public virtual int Quantity { get; set; }
public virtual int Total { get; set; }
}
public enum SkuType
{
Product,
PerDev,
PerCore,
Site,
Support,
Training,
Register,
Payment,
}
public partial class Subscription
{
public virtual int Id { get; set; }
public virtual int CustomerId { get; set; }
public virtual string Email { get; set; }
public virtual int SkuId { get; set; }
public virtual string SkuName { get; set; }
public virtual SkuType SkuType { get; set; }
public virtual string Code { get; set; }
public virtual int Quantity { get; set; }
public virtual int SupportQuantity { get; set; }
public virtual int Total { get; set; }
public virtual bool IsPlan { get; set; }
public virtual bool IsRenewal { get; set; }
public virtual int SubscriptionDurationDays { get; set; }
public virtual DateTime? RenewalDate { get; set; }
public virtual string LicenseRef { get; set; }
public virtual string LicenseName { get; set; }
public virtual string LicenseAddress { get; set; }
public virtual LicenseType LicenseType { get; set; }
public virtual DateTime ExpiryDate { get; set; }
public virtual LicenseKey LicenseKey { get; set; }
public virtual string LicenseKeyText { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual DateTime ModifiedDate { get; set; }
public virtual DateTime? CancelledDate { get; set; }
public virtual string StripeSubscriptionId { get; set; }
public virtual int? EmailId { get; set; }
public virtual int? EmailRenewalId { get; set; }
public virtual int? EmailExpiredId { get; set; }
public virtual int? RenewalSubscriptionId { get; set; }
public virtual string ExternalRef { get; set; }
public virtual string Notes { get; set; }
public virtual string Error { get; set; }
}
}
namespace ServiceStack
{
public partial class LicenseKey
{
public virtual string Ref { get; set; }
public virtual string Name { get; set; }
public virtual LicenseType Type { get; set; }
public virtual long Meta { get; set; }
public virtual string Hash { get; set; }
public virtual string Halg { get; set; }
public virtual DateTime Expiry { get; set; }
}
public enum LicenseType
{
Free,
FreeIndividual,
FreeOpenSource,
Indie,
Business,
Enterprise,
TextIndie,
TextBusiness,
OrmLiteIndie,
OrmLiteBusiness,
RedisIndie,
RedisBusiness,
AwsIndie,
AwsBusiness,
Trial,
Site,
TextSite,
RedisSite,
OrmLiteSite,
}
[DataContract]
public partial class QueryBase
{
[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 QueryDb<T>
: QueryBase
{
}
[DataContract]
public partial class QueryResponse<T>
{
[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; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /query/subscriptions HTTP/1.1
Host: account.servicestack.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<QuerySubscriptions xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceInterface">
<Skip xmlns="http://schemas.servicestack.net/types">0</Skip>
<Take xmlns="http://schemas.servicestack.net/types">0</Take>
<OrderBy xmlns="http://schemas.servicestack.net/types">String</OrderBy>
<OrderByDesc xmlns="http://schemas.servicestack.net/types">String</OrderByDesc>
<Include xmlns="http://schemas.servicestack.net/types">String</Include>
<Fields xmlns="http://schemas.servicestack.net/types">String</Fields>
<Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.servicestack.net/types">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</Meta>
</QuerySubscriptions>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <QueryResponseOfSubscriptiontlJ4_P31p xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <Offset>0</Offset> <Total>0</Total> <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel"> <d2p1:Subscription> <d2p1:CancelledDate>0001-01-01T00:00:00</d2p1:CancelledDate> <d2p1:Code>String</d2p1:Code> <d2p1:CreatedDate>0001-01-01T00:00:00</d2p1:CreatedDate> <d2p1:CustomerId>0</d2p1:CustomerId> <d2p1:Email>String</d2p1:Email> <d2p1:EmailExpiredId>0</d2p1:EmailExpiredId> <d2p1:EmailId>0</d2p1:EmailId> <d2p1:EmailRenewalId>0</d2p1:EmailRenewalId> <d2p1:Error>String</d2p1:Error> <d2p1:ExpiryDate>0001-01-01T00:00:00</d2p1:ExpiryDate> <d2p1:ExternalRef>String</d2p1:ExternalRef> <d2p1:Id>0</d2p1:Id> <d2p1:IsPlan>false</d2p1:IsPlan> <d2p1:IsRenewal>false</d2p1:IsRenewal> <d2p1:LicenseAddress>String</d2p1:LicenseAddress> <d2p1:LicenseKey xmlns:d4p1="http://schemas.datacontract.org/2004/07/ServiceStack"> <d4p1:Expiry>0001-01-01T00:00:00</d4p1:Expiry> <d4p1:Halg>String</d4p1:Halg> <d4p1:Hash>String</d4p1:Hash> <d4p1:Meta>0</d4p1:Meta> <d4p1:Name>String</d4p1:Name> <d4p1:Ref>String</d4p1:Ref> <d4p1:Type>Free</d4p1:Type> </d2p1:LicenseKey> <d2p1:LicenseKeyText>String</d2p1:LicenseKeyText> <d2p1:LicenseName>String</d2p1:LicenseName> <d2p1:LicenseRef>String</d2p1:LicenseRef> <d2p1:LicenseType>Free</d2p1:LicenseType> <d2p1:ModifiedDate>0001-01-01T00:00:00</d2p1:ModifiedDate> <d2p1:Notes>String</d2p1:Notes> <d2p1:Quantity>0</d2p1:Quantity> <d2p1:RenewalDate>0001-01-01T00:00:00</d2p1:RenewalDate> <d2p1:RenewalSubscriptionId>0</d2p1:RenewalSubscriptionId> <d2p1:SkuId>0</d2p1:SkuId> <d2p1:SkuName>String</d2p1:SkuName> <d2p1:SkuType>Product</d2p1:SkuType> <d2p1:StripeSubscriptionId>String</d2p1:StripeSubscriptionId> <d2p1:SubscriptionDurationDays>0</d2p1:SubscriptionDurationDays> <d2p1:SupportQuantity>0</d2p1:SupportQuantity> <d2p1:Total>0</d2p1:Total> </d2p1:Subscription> </Results> <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:KeyValueOfstringstring> <d2p1:Key>String</d2p1:Key> <d2p1:Value>String</d2p1:Value> </d2p1:KeyValueOfstringstring> </Meta> <ResponseStatus> <ErrorCode>String</ErrorCode> <Message>String</Message> <StackTrace>String</StackTrace> <Errors> <ResponseError> <ErrorCode>String</ErrorCode> <FieldName>String</FieldName> <Message>String</Message> <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </Meta> </ResponseError> </Errors> <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </Meta> </ResponseStatus> </QueryResponseOfSubscriptiontlJ4_P31p>