BokaMera.API.Host

<back to all web services

CreateIncentive

Requires Authentication
Requires the role:superadmin
The following routes are available for this service:
POST/superadmin/incentivesAdd a new incentive
import java.math.*
import java.util.*
import net.servicestack.client.*


@ValidateRequest(Validator="IsAuthenticated")
@ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
open class CreateIncentive
{
    @ApiMember(IsRequired=true)
    var Heading:String? = null

    @ApiMember()
    var StorageUrl:String? = null

    @ApiMember()
    var Body:String? = null

    @ApiMember(IsRequired=true)
    var SuccessButtonText:String? = null

    @ApiMember(IsRequired=true)
    var ActionId:Int? = null

    @ApiMember(IsRequired=true)
    var Frequency:IncentiveRecurrenceFrequency? = null

    @ApiMember()
    var RecurrenceInterval:Long? = null

    @ApiMember(IsRequired=true)
    var InitialDelayInSeconds:Int? = null

    @ApiMember(IsRequired=true)
    var MaxDisplayCount:Int? = null

    @ApiMember(IsRequired=true)
    var ValidFrom:Date? = null

    @ApiMember(IsRequired=true)
    var ValidTo:Date? = null

    @ApiMember()
    var Active:Boolean? = null

    @ApiMember()
    var Payload:String? = null

    var CompanyIds:ArrayList<UUID> = ArrayList<UUID>()
    var Criteria:ArrayList<IncentiveCriteriaDto> = ArrayList<IncentiveCriteriaDto>()
    /**
    * Number of days to wait after first display attempt before displaying the incentive. Set to 0 to show immediately.
    */
    @ApiMember(Description="Number of days to wait after first display attempt before displaying the incentive. Set to 0 to show immediately.", IsRequired=true)
    var InitialDeferredDays:Int? = null
}

enum class IncentiveRecurrenceFrequency(val value:Int)
{
    OneTime(1),
    Weekly(2),
    Monthly(3),
}

open class IncentiveCriteriaDto
{
    var CriteriaType:CriteriaType? = null
    var Value:String? = null
    var InvertCondition:Boolean? = null
}

enum class CriteriaType
{
    LicenseAvailability,
    SmsActivation,
    EAccountingActivation,
    CodeLockActivation,
    SocialActivation,
    OnlinePaymentActivation,
    FollowUpMessageActivation,
    RatingActivation,
}

open class AdminIncentiveQueryResponse : CompanyIncentiveResponse()
{
    var Frequency:IncentiveRecurrenceFrequency? = null
    var RecurrenceInterval:Long? = null
    var CreatedDate:Date? = null
    var ModifiedDate:Date? = null
    var CompanyIds:ArrayList<UUID> = ArrayList<UUID>()
    var Criteria:ArrayList<IncentiveCriteria> = ArrayList<IncentiveCriteria>()
    var ApplyToAllCompanies:Boolean? = null
    var Action:IncentiveActionResponse? = null
}

open class CompanyIncentiveResponse
{
    var Id:Int? = null
    var Heading:String? = null
    var StorageUrl:String? = null
    var SuccessButtonText:String? = null
    var ActionId:Int? = null
    var InitialDelayInSeconds:Int? = null
    var MaxDisplayCount:Int? = null
    var ValidFrom:Date? = null
    var ValidTo:Date? = null
    var Action:IncentiveActionResponse? = null
    var Payload:String? = null
    @ApiMember()
    var Body:String? = null

    @ApiMember(IsRequired=true)
    var Frequency:IncentiveRecurrenceFrequency? = null

    @ApiMember(IsRequired=true)
    var InitialDeferredDays:Int? = null

    @ApiMember()
    var RecurrenceInterval:Long? = null

    @ApiMember()
    var Active:Boolean? = null

    var CompanyIds:ArrayList<UUID> = ArrayList<UUID>()
    var Criteria:ArrayList<IncentiveCriteriaDto> = ArrayList<IncentiveCriteriaDto>()
}

open class IncentiveActionResponse
{
    var Id:Int? = null
    var Description:String? = null
    var ActionType:IncentiveActionType? = null
    var Page:String? = null
    var Segment:String? = null
    var Element:String? = null
    var LicenseTypeId:Int? = null
    var SuggestedLicenseToUpgrade:LicenseTypeQueryResponse? = null
}

enum class IncentiveActionType(val value:Int)
{
    Upgrade(1),
    AddOn(2),
    Information(3),
}

open class LicenseTypeQueryResponse
{
    /**
    * The license type id
    */
    @ApiMember(Description="The license type id")
    var Id:Int? = null

    /**
    * The license type name
    */
    @ApiMember(Description="The license type name")
    var Name:String? = null

    /**
    * The license type description
    */
    @ApiMember(Description="The license type description")
    var Description:String? = null

    /**
    * If the license type is not a standard license but instead an extra license option. An example would be sending new letter license.
    */
    @ApiMember(Description="If the license type is not a standard license but instead an extra license option. An example would be sending new letter license.")
    var IsExtraLicenseOption:Boolean? = null

    /**
    * The period of notice for the license in days.
    */
    @ApiMember(Description="The period of notice for the license in days.")
    var PeriodOfNoticeDays:Int? = null

    /**
    * The license items for the license type
    */
    @ApiMember(Description="The license items for the license type")
    var Items:ArrayList<LicenseItemsResponse> = ArrayList<LicenseItemsResponse>()

    /**
    * The license prices in each country for the license type
    */
    @ApiMember(Description="The license prices in each country for the license type")
    var Prices:ArrayList<LicensePrice> = ArrayList<LicensePrice>()
}

open class LicenseItemsResponse
{
    var Id:Int? = null
    var Name:String? = null
    var AllowedItems:Int? = null
}

open class LicensePrice : BaseModel()
{
    @Ignore()
    var Country:Country? = null

    @Ignore()
    var MonthlyPayment:Boolean? = null

    @Required()
    var LicenseTypeId:Int? = null

    @Required()
    var CountryId:String? = null

    @Required()
    var Price:Int? = null

    var ModifiedDate:Date? = null
}

open class BaseModel
{
}

open class Country : BaseModel()
{
    @References(Currency.class)
    var CurrencyId:String? = null

    var CurrencyInfo:Currency? = null
    @Required()
    var Name:String? = null

    var Culture:String? = null
    var TimeZone:String? = null
    var ModifiedDate:Date? = null
    @Required()
    var Id:String? = null
}

open class Currency : BaseModel()
{
    @Required()
    var Name:String? = null

    @Required()
    var CurrencySign:String? = null

    @Required()
    var Active:Boolean? = null

    var ModifiedDate:Date? = null
    @Required()
    var Id:String? = null
}

open class IncentiveCriteria : BaseModel()
{
    var Id:Int? = null
    var IncentiveId:Int? = null
    var CriteriaType:CriteriaType? = null
    var Value:String? = null
    var InvertCondition:Boolean? = null
    var CreatedDate:Date? = null
}

Kotlin CreateIncentive DTOs

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

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /superadmin/incentives HTTP/1.1 
Host: api.bookmore.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Heading: String,
	StorageUrl: String,
	Body: String,
	SuccessButtonText: String,
	ActionId: 0,
	Frequency: OneTime,
	RecurrenceInterval: 0,
	InitialDelayInSeconds: 0,
	MaxDisplayCount: 0,
	ValidFrom: 0001-01-01T00:00:00.0000000+00:00,
	ValidTo: 0001-01-01T00:00:00.0000000+00:00,
	Active: False,
	Payload: String,
	CompanyIds: 
	[
		00000000-0000-0000-0000-000000000000
	],
	Criteria: 
	[
		{
			CriteriaType: LicenseAvailability,
			Value: String,
			InvertCondition: False
		}
	],
	InitialDeferredDays: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	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
		}
	]
}