Requires the role: | superadmin |
GET | /superadmin/incentives/ | Query incentives |
---|
import java.math.*;
import java.util.*;
import net.servicestack.client.*;
import com.google.gson.annotations.*;
import com.google.gson.reflect.*;
public class dtos
{
@ValidateRequest(Validator="IsAuthenticated")
@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
public static class AdminIncentivesQuery extends QueryDb<Incentive, QueryResponse<AdminIncentiveQueryResponse>>
{
public Integer Id = null;
public UUID CompanyId = null;
public Date ValidFrom = null;
public Date ValidTo = null;
public Integer ActionId = null;
public Boolean Active = null;
public Boolean IncludeCriteria = null;
public Boolean IncludeCompanies = null;
public Boolean IncludeAction = null;
public Integer getId() { return Id; }
public AdminIncentivesQuery setId(Integer value) { this.Id = value; return this; }
public UUID getCompanyId() { return CompanyId; }
public AdminIncentivesQuery setCompanyId(UUID value) { this.CompanyId = value; return this; }
public Date getValidFrom() { return ValidFrom; }
public AdminIncentivesQuery setValidFrom(Date value) { this.ValidFrom = value; return this; }
public Date getValidTo() { return ValidTo; }
public AdminIncentivesQuery setValidTo(Date value) { this.ValidTo = value; return this; }
public Integer getActionId() { return ActionId; }
public AdminIncentivesQuery setActionId(Integer value) { this.ActionId = value; return this; }
public Boolean isActive() { return Active; }
public AdminIncentivesQuery setActive(Boolean value) { this.Active = value; return this; }
public Boolean isIncludeCriteria() { return IncludeCriteria; }
public AdminIncentivesQuery setIncludeCriteria(Boolean value) { this.IncludeCriteria = value; return this; }
public Boolean isIncludeCompanies() { return IncludeCompanies; }
public AdminIncentivesQuery setIncludeCompanies(Boolean value) { this.IncludeCompanies = value; return this; }
public Boolean isIncludeAction() { return IncludeAction; }
public AdminIncentivesQuery setIncludeAction(Boolean value) { this.IncludeAction = value; return this; }
}
public static class QueryDb<From, Into> extends QueryBase
{
}
@DataContract
public static class QueryBase
{
/**
* Skip over a given number of elements in a sequence and then return the remainder. Use this when you need paging.<br/><br/><strong>Example:</strong><br/><code>?skip=10&orderBy=Id</code>
*/
@DataMember(Order=1)
public Integer Skip = null;
/**
* Return a given number of elements in a sequence and then skip over the remainder. Use this when you need paging.<br/><br/><strong>Example:</strong><br/><code>?take=20</code>
*/
@DataMember(Order=2)
public Integer Take = null;
/**
* Comma separated list of fields to order by. Prefix the field name with a minus if you wan't to invert the sort for that field.<br/><br/><strong>Example:</strong><br/><code>?orderBy=Id,-Age,FirstName</code>
*/
@DataMember(Order=3)
public String OrderBy = null;
/**
* Comma separated list of fields to order by in descending order. Prefix the field name with a minus if you wan't to invert the sort for that field.<br/><br/><strong>Example:</strong><br/><code>?orderByDesc=Id,-Age,FirstName</code>
*/
@DataMember(Order=4)
public String OrderByDesc = null;
/**
* Include any of the aggregates <code>AVG, COUNT, FIRST, LAST, MAX, MIN, SUM</code> in your result set. The results will be returned in the meta field.<br/><br/><strong>Example:</strong><br/><code>?include=COUNT(*) as Total</code><br/><br/>or multiple fields with<br/><code>?include=Count(*) Total, Min(Age), AVG(Age) AverageAge</code><br/></br>or unique with<br/><code>?include=COUNT(DISTINCT LivingStatus) as UniqueStatus</code>
*/
@DataMember(Order=5)
public String Include = null;
@DataMember(Order=6)
public String Fields = null;
@DataMember(Order=7)
public HashMap<String,String> Meta = null;
public Integer getSkip() { return Skip; }
public QueryBase setSkip(Integer value) { this.Skip = value; return this; }
public Integer getTake() { return Take; }
public QueryBase setTake(Integer value) { this.Take = value; return this; }
public String getOrderBy() { return OrderBy; }
public QueryBase setOrderBy(String value) { this.OrderBy = value; return this; }
public String getOrderByDesc() { return OrderByDesc; }
public QueryBase setOrderByDesc(String value) { this.OrderByDesc = value; return this; }
public String getInclude() { return Include; }
public QueryBase setInclude(String value) { this.Include = value; return this; }
public String getFields() { return Fields; }
public QueryBase setFields(String value) { this.Fields = value; return this; }
public HashMap<String,String> getMeta() { return Meta; }
public QueryBase setMeta(HashMap<String,String> value) { this.Meta = value; return this; }
}
public static class Incentive extends BaseModel
{
public Integer Id = null;
public String Heading = null;
public String StorageUrl = null;
public String SuccessButtonText = null;
public Boolean Active = null;
public Integer ActionId = null;
public IncentiveRecurrenceFrequency Frequency = null;
public Long RecurrenceInterval = null;
public Integer InitialDelayInSeconds = null;
public Integer MaxDisplayCount = null;
public Date ValidFrom = null;
public Date ValidTo = null;
public Date CreatedDate = null;
public Date ModifiedDate = null;
public Boolean AppliesToAllCompanies = null;
public String Payload = null;
public Integer InitialDeferredDays = null;
public ArrayList<IncentiveCompanyRelation> Companies = null;
public ArrayList<IncentiveCriteria> Criteria = null;
@Ignore()
public IncentiveAction Action = null;
public Integer getId() { return Id; }
public Incentive setId(Integer value) { this.Id = value; return this; }
public String getHeading() { return Heading; }
public Incentive setHeading(String value) { this.Heading = value; return this; }
public String getStorageUrl() { return StorageUrl; }
public Incentive setStorageUrl(String value) { this.StorageUrl = value; return this; }
public String getSuccessButtonText() { return SuccessButtonText; }
public Incentive setSuccessButtonText(String value) { this.SuccessButtonText = value; return this; }
public Boolean isActive() { return Active; }
public Incentive setActive(Boolean value) { this.Active = value; return this; }
public Integer getActionId() { return ActionId; }
public Incentive setActionId(Integer value) { this.ActionId = value; return this; }
public IncentiveRecurrenceFrequency getFrequency() { return Frequency; }
public Incentive setFrequency(IncentiveRecurrenceFrequency value) { this.Frequency = value; return this; }
public Long getRecurrenceInterval() { return RecurrenceInterval; }
public Incentive setRecurrenceInterval(Long value) { this.RecurrenceInterval = value; return this; }
public Integer getInitialDelayInSeconds() { return InitialDelayInSeconds; }
public Incentive setInitialDelayInSeconds(Integer value) { this.InitialDelayInSeconds = value; return this; }
public Integer getMaxDisplayCount() { return MaxDisplayCount; }
public Incentive setMaxDisplayCount(Integer value) { this.MaxDisplayCount = value; return this; }
public Date getValidFrom() { return ValidFrom; }
public Incentive setValidFrom(Date value) { this.ValidFrom = value; return this; }
public Date getValidTo() { return ValidTo; }
public Incentive setValidTo(Date value) { this.ValidTo = value; return this; }
public Date getCreatedDate() { return CreatedDate; }
public Incentive setCreatedDate(Date value) { this.CreatedDate = value; return this; }
public Date getModifiedDate() { return ModifiedDate; }
public Incentive setModifiedDate(Date value) { this.ModifiedDate = value; return this; }
public Boolean isAppliesToAllCompanies() { return AppliesToAllCompanies; }
public Incentive setAppliesToAllCompanies(Boolean value) { this.AppliesToAllCompanies = value; return this; }
public String getPayload() { return Payload; }
public Incentive setPayload(String value) { this.Payload = value; return this; }
public Integer getInitialDeferredDays() { return InitialDeferredDays; }
public Incentive setInitialDeferredDays(Integer value) { this.InitialDeferredDays = value; return this; }
public ArrayList<IncentiveCompanyRelation> getCompanies() { return Companies; }
public Incentive setCompanies(ArrayList<IncentiveCompanyRelation> value) { this.Companies = value; return this; }
public ArrayList<IncentiveCriteria> getCriteria() { return Criteria; }
public Incentive setCriteria(ArrayList<IncentiveCriteria> value) { this.Criteria = value; return this; }
public IncentiveAction getAction() { return Action; }
public Incentive setAction(IncentiveAction value) { this.Action = value; return this; }
}
public static class BaseModel
{
}
public static enum IncentiveRecurrenceFrequency
{
OneTime(1),
Weekly(2),
Monthly(3);
private final int value;
IncentiveRecurrenceFrequency(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class IncentiveCompanyRelation extends BaseModel
{
public Long Id = null;
public UUID CompanyId = null;
public Integer IncentiveId = null;
public Date CreatedDate = null;
public Long getId() { return Id; }
public IncentiveCompanyRelation setId(Long value) { this.Id = value; return this; }
public UUID getCompanyId() { return CompanyId; }
public IncentiveCompanyRelation setCompanyId(UUID value) { this.CompanyId = value; return this; }
public Integer getIncentiveId() { return IncentiveId; }
public IncentiveCompanyRelation setIncentiveId(Integer value) { this.IncentiveId = value; return this; }
public Date getCreatedDate() { return CreatedDate; }
public IncentiveCompanyRelation setCreatedDate(Date value) { this.CreatedDate = value; return this; }
}
public static class IncentiveCriteria extends BaseModel
{
public Integer Id = null;
public Integer IncentiveId = null;
public CriteriaType CriteriaType = null;
public String Value = null;
public Boolean InvertCondition = null;
public Date CreatedDate = null;
public Integer getId() { return Id; }
public IncentiveCriteria setId(Integer value) { this.Id = value; return this; }
public Integer getIncentiveId() { return IncentiveId; }
public IncentiveCriteria setIncentiveId(Integer value) { this.IncentiveId = value; return this; }
public CriteriaType getCriteriaType() { return CriteriaType; }
public IncentiveCriteria setCriteriaType(CriteriaType value) { this.CriteriaType = value; return this; }
public String getValue() { return Value; }
public IncentiveCriteria setValue(String value) { this.Value = value; return this; }
public Boolean isInvertCondition() { return InvertCondition; }
public IncentiveCriteria setInvertCondition(Boolean value) { this.InvertCondition = value; return this; }
public Date getCreatedDate() { return CreatedDate; }
public IncentiveCriteria setCreatedDate(Date value) { this.CreatedDate = value; return this; }
}
public static enum CriteriaType
{
LicenseAvailability,
SmsActivation,
EAccountingActivation,
CodeLockActivation,
SocialActivation,
OnlinePaymentActivation,
FollowUpMessageActivation,
RatingActivation;
}
public static class IncentiveAction extends BaseModel
{
public Integer Id = null;
public String Description = null;
public IncentiveActionType ActionType = null;
public String Page = null;
public String Segment = null;
public String Element = null;
public Integer LicenseTypeId = null;
public Integer getId() { return Id; }
public IncentiveAction setId(Integer value) { this.Id = value; return this; }
public String getDescription() { return Description; }
public IncentiveAction setDescription(String value) { this.Description = value; return this; }
public IncentiveActionType getActionType() { return ActionType; }
public IncentiveAction setActionType(IncentiveActionType value) { this.ActionType = value; return this; }
public String getPage() { return Page; }
public IncentiveAction setPage(String value) { this.Page = value; return this; }
public String getSegment() { return Segment; }
public IncentiveAction setSegment(String value) { this.Segment = value; return this; }
public String getElement() { return Element; }
public IncentiveAction setElement(String value) { this.Element = value; return this; }
public Integer getLicenseTypeId() { return LicenseTypeId; }
public IncentiveAction setLicenseTypeId(Integer value) { this.LicenseTypeId = value; return this; }
}
public static enum IncentiveActionType
{
Upgrade(1),
AddOn(2),
Information(3);
private final int value;
IncentiveActionType(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
@DataContract
public static class QueryResponse<AccessKeyTypeResponse>
{
@DataMember(Order=1)
public Integer Offset = null;
@DataMember(Order=2)
public Integer Total = null;
@DataMember(Order=3)
public ArrayList<AccessKeyTypeResponse> Results = null;
@DataMember(Order=4)
public HashMap<String,String> Meta = null;
@DataMember(Order=5)
public ResponseStatus ResponseStatus = null;
public Integer getOffset() { return Offset; }
public QueryResponse<AccessKeyTypeResponse> setOffset(Integer value) { this.Offset = value; return this; }
public Integer getTotal() { return Total; }
public QueryResponse<AccessKeyTypeResponse> setTotal(Integer value) { this.Total = value; return this; }
public ArrayList<AccessKeyTypeResponse> getResults() { return Results; }
public QueryResponse<AccessKeyTypeResponse> setResults(ArrayList<AccessKeyTypeResponse> value) { this.Results = value; return this; }
public HashMap<String,String> getMeta() { return Meta; }
public QueryResponse<AccessKeyTypeResponse> setMeta(HashMap<String,String> value) { this.Meta = value; return this; }
public ResponseStatus getResponseStatus() { return ResponseStatus; }
public QueryResponse<AccessKeyTypeResponse> setResponseStatus(ResponseStatus value) { this.ResponseStatus = value; return this; }
}
public static class AccessKeyTypeResponse
{
public Integer Id = null;
public String KeyType = null;
public String Description = null;
public Integer getId() { return Id; }
public AccessKeyTypeResponse setId(Integer value) { this.Id = value; return this; }
public String getKeyType() { return KeyType; }
public AccessKeyTypeResponse setKeyType(String value) { this.KeyType = value; return this; }
public String getDescription() { return Description; }
public AccessKeyTypeResponse setDescription(String value) { this.Description = value; return this; }
}
}
Java AdminIncentivesQuery 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.
GET /superadmin/incentives/ HTTP/1.1 Host: api.bookmore.com Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Offset: 0, Total: 0, Results: [ { Offset: 0, Total: 0, Results: [ { Frequency: OneTime, RecurrenceInterval: 0, CreatedDate: 0001-01-01T00:00:00.0000000+00:00, ModifiedDate: 0001-01-01T00:00:00.0000000+00:00, CompanyIds: [ 00000000-0000-0000-0000-000000000000 ], Criteria: [ { Id: 0, IncentiveId: 0, CriteriaType: LicenseAvailability, Value: String, InvertCondition: False, CreatedDate: 0001-01-01T00:00:00.0000000+00:00 } ], ApplyToAllCompanies: False, Action: { Id: 0, Description: String, ActionType: Upgrade, Page: String, Segment: String, Element: String, LicenseTypeId: 0, SuggestedLicenseToUpgrade: { Id: 0, Name: String, Description: String, IsExtraLicenseOption: False, PeriodOfNoticeDays: 0, Items: [ { Id: 0, Name: String, AllowedItems: 0 } ], Prices: [ { Country: { CurrencyId: String, CurrencyInfo: { Name: String, CurrencySign: String, Active: False, ModifiedDate: 0001-01-01T00:00:00.0000000+00:00, Id: String }, Name: String, Culture: String, TimeZone: String, ModifiedDate: 0001-01-01T00:00:00.0000000+00:00, Id: String }, MonthlyPayment: True, LicenseTypeId: 0, CountryId: String, Price: 0, ModifiedDate: 0001-01-01T00:00:00.0000000+00:00 } ] } }, Id: 0, Heading: String, StorageUrl: String, SuccessButtonText: String, ActionId: 0, InitialDelayInSeconds: 0, MaxDisplayCount: 0, ValidFrom: 0001-01-01T00:00:00.0000000+00:00, ValidTo: 0001-01-01T00:00:00.0000000+00:00, Payload: String, Body: String, InitialDeferredDays: 0, Active: False, Criteria: [ { CriteriaType: LicenseAvailability, Value: String, InvertCondition: False } ] } ], Meta: { String: String }, ResponseStatus: { ErrorCode: String, Message: String, StackTrace: String, Errors: [ { ErrorCode: String, FieldName: String, Message: String, Meta: { String: String } } ], Meta: { String: String } } } ], Meta: { String: String }, ResponseStatus: { ErrorCode: String, Message: String, StackTrace: String, Errors: [ { ErrorCode: String, FieldName: String, Message: String, Meta: { String: String } } ], Meta: { String: String } } }