BokaMera.API.Host

<back to all web services

AdminIncentivesQuery

Requires Authentication
Requires the role:superadmin
The following routes are available for this service:
GET/superadmin/incentives/Query incentives

// @DataContract
export class QueryBase
{
    /** @description 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 Skip?: number;

    /** @description 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 Take?: number;

    /** @description 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 OrderBy: string;

    /** @description 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 OrderByDesc: string;

    /** @description 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 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<From, Into> extends QueryBase
{

    public constructor(init?: Partial<QueryDb<From, Into>>) { super(init); (Object as any).assign(this, init); }
}

export class BaseModel
{

    public constructor(init?: Partial<BaseModel>) { (Object as any).assign(this, init); }
}

export enum IncentiveRecurrenceFrequency
{
    OneTime = 1,
    Weekly = 2,
    Monthly = 3,
}

export class IncentiveCompanyRelation extends BaseModel
{
    public Id: number;
    public CompanyId: string;
    public IncentiveId: number;
    public CreatedDate: string;

    public constructor(init?: Partial<IncentiveCompanyRelation>) { super(init); (Object as any).assign(this, init); }
}

export enum CriteriaType
{
    LicenseAvailability = 'LicenseAvailability',
    SmsActivation = 'SmsActivation',
    eAccountingActivation = 'eAccountingActivation',
    CodeLockActivation = 'CodeLockActivation',
    SocialActivation = 'SocialActivation',
    OnlinePaymentActivation = 'OnlinePaymentActivation',
    FollowUpMessageActivation = 'FollowUpMessageActivation',
    RatingActivation = 'RatingActivation',
}

export class IncentiveCriteria extends BaseModel
{
    public Id: number;
    public IncentiveId: number;
    public CriteriaType: CriteriaType;
    public Value: string;
    public InvertCondition: boolean;
    public CreatedDate: string;

    public constructor(init?: Partial<IncentiveCriteria>) { super(init); (Object as any).assign(this, init); }
}

export enum IncentiveActionType
{
    Upgrade = 1,
    AddOn = 2,
    Information = 3,
}

export class IncentiveAction extends BaseModel
{
    public Id: number;
    public Description: string;
    public ActionType: IncentiveActionType;
    public Page: string;
    public Segment: string;
    public Element: string;
    public LicenseTypeId?: number;

    public constructor(init?: Partial<IncentiveAction>) { super(init); (Object as any).assign(this, init); }
}

export class Incentive extends BaseModel
{
    public Id: number;
    public Heading: string;
    public StorageUrl: string;
    public SuccessButtonText: string;
    public Active: boolean;
    public ActionId: number;
    public Frequency: IncentiveRecurrenceFrequency;
    public RecurrenceInterval: number;
    public InitialDelayInSeconds: number;
    public MaxDisplayCount?: number;
    public ValidFrom: string;
    public ValidTo: string;
    public CreatedDate: string;
    public ModifiedDate?: string;
    public AppliesToAllCompanies: boolean;
    public Payload: string;
    public InitialDeferredDays: number;
    public Companies: IncentiveCompanyRelation[];
    public Criteria: IncentiveCriteria[];
    // @Ignore()
    public Action: IncentiveAction;

    public constructor(init?: Partial<Incentive>) { super(init); (Object as any).assign(this, init); }
}

// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
export class AdminIncentivesQuery extends QueryDb<Incentive, QueryResponse<AdminIncentiveQueryResponse>>
{
    public Id?: number;
    public CompanyId?: string;
    public ValidFrom?: Date;
    public ValidTo?: Date;
    public ActionId?: number;
    public Active?: boolean;
    public IncludeCriteria: boolean;
    public IncludeCompanies: boolean;
    public IncludeAction: boolean;

    public constructor(init?: Partial<AdminIncentivesQuery>) { super(init); (Object as any).assign(this, init); }
}

export class AccessKeyTypeResponse
{
    public Id: number;
    public KeyType: string;
    public Description: string;

    public constructor(init?: Partial<AccessKeyTypeResponse>) { (Object as any).assign(this, init); }
}

// @DataContract
export class QueryResponse<AccessKeyTypeResponse>
{
    // @DataMember(Order=1)
    public Offset: number;

    // @DataMember(Order=2)
    public Total: number;

    // @DataMember(Order=3)
    public Results: AccessKeyTypeResponse[];

    // @DataMember(Order=4)
    public Meta: { [index: string]: string; };

    // @DataMember(Order=5)
    public ResponseStatus: ResponseStatus;

    public constructor(init?: Partial<QueryResponse<AccessKeyTypeResponse>>) { (Object as any).assign(this, init); }
}

TypeScript AdminIncentivesQuery DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

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.bokamera.se 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
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"}}}