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
namespace BokaMera.API.ServiceModel.Db

open System
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations

    type IncentiveActionType =
        | Upgrade = 1
        | AddOn = 2
        | Information = 3

    [<AllowNullLiteral>]
    type LicenseItemsResponse() = 
        member val Id:Int32 = new Int32() with get,set
        member val Name:String = null with get,set
        member val AllowedItems:Int32 = new Int32() with get,set

    [<AllowNullLiteral>]
    type BaseModel() = 
        class end

    [<AllowNullLiteral>]
    type Currency() = 
        inherit BaseModel()
        [<Required>]
        member val Name:String = null with get,set

        [<Required>]
        member val CurrencySign:String = null with get,set

        [<Required>]
        member val Active:Boolean = new Boolean() with get,set

        member val ModifiedDate:Nullable<DateTimeOffset> = new Nullable<DateTimeOffset>() with get,set
        [<Required>]
        member val Id:String = null with get,set

    [<AllowNullLiteral>]
    type Country() = 
        inherit BaseModel()
        [<References(typeof<Currency>)>]
        member val CurrencyId:String = null with get,set

        member val CurrencyInfo:Currency = null with get,set
        [<Required>]
        member val Name:String = null with get,set

        member val Culture:String = null with get,set
        member val TimeZone:String = null with get,set
        member val ModifiedDate:Nullable<DateTimeOffset> = new Nullable<DateTimeOffset>() with get,set
        [<Required>]
        member val Id:String = null with get,set

    [<AllowNullLiteral>]
    type LicensePrice() = 
        inherit BaseModel()
        [<Ignore>]
        member val Country:Country = null with get,set

        [<Ignore>]
        member val MonthlyPayment:Boolean = new Boolean() with get,set

        [<Required>]
        member val LicenseTypeId:Int32 = new Int32() with get,set

        [<Required>]
        member val CountryId:String = null with get,set

        [<Required>]
        member val Price:Int32 = new Int32() with get,set

        member val ModifiedDate:Nullable<DateTimeOffset> = new Nullable<DateTimeOffset>() with get,set

    [<AllowNullLiteral>]
    type LicenseTypeQueryResponse() = 
        ///<summary>
        ///The license type id
        ///</summary>
        [<ApiMember(Description="The license type id")>]
        member val Id:Int32 = new Int32() with get,set

        ///<summary>
        ///The license type name
        ///</summary>
        [<ApiMember(Description="The license type name")>]
        member val Name:String = null with get,set

        ///<summary>
        ///The license type description
        ///</summary>
        [<ApiMember(Description="The license type description")>]
        member val Description:String = null with get,set

        ///<summary>
        ///If the license type is not a standard license but instead an extra license option. An example would be sending new letter license.
        ///</summary>
        [<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.")>]
        member val IsExtraLicenseOption:Boolean = new Boolean() with get,set

        ///<summary>
        ///The period of notice for the license in days.
        ///</summary>
        [<ApiMember(Description="The period of notice for the license in days.")>]
        member val PeriodOfNoticeDays:Int32 = new Int32() with get,set

        ///<summary>
        ///The license items for the license type
        ///</summary>
        [<ApiMember(Description="The license items for the license type")>]
        member val Items:ResizeArray<LicenseItemsResponse> = new ResizeArray<LicenseItemsResponse>() with get,set

        ///<summary>
        ///The license prices in each country for the license type
        ///</summary>
        [<ApiMember(Description="The license prices in each country for the license type")>]
        member val Prices:ResizeArray<LicensePrice> = new ResizeArray<LicensePrice>() with get,set

    [<AllowNullLiteral>]
    type IncentiveActionResponse() = 
        member val Id:Int32 = new Int32() with get,set
        member val Description:String = null with get,set
        member val ActionType:IncentiveActionType = new IncentiveActionType() with get,set
        member val Page:String = null with get,set
        member val Segment:String = null with get,set
        member val Element:String = null with get,set
        member val LicenseTypeId:Nullable<Int32> = new Nullable<Int32>() with get,set
        member val SuggestedLicenseToUpgrade:LicenseTypeQueryResponse = null with get,set

    type IncentiveRecurrenceFrequency =
        | OneTime = 1
        | Weekly = 2
        | Monthly = 3

    type CriteriaType =
        | LicenseAvailability = 0
        | SmsActivation = 1
        | eAccountingActivation = 2
        | CodeLockActivation = 3
        | SocialActivation = 4
        | OnlinePaymentActivation = 5
        | FollowUpMessageActivation = 6
        | RatingActivation = 7

    [<AllowNullLiteral>]
    type IncentiveCriteriaDto() = 
        member val CriteriaType:CriteriaType = new CriteriaType() with get,set
        member val Value:String = null with get,set
        member val InvertCondition:Boolean = new Boolean() with get,set

    [<AllowNullLiteral>]
    type CompanyIncentiveResponse() = 
        member val Id:Int32 = new Int32() with get,set
        member val Heading:String = null with get,set
        member val StorageUrl:String = null with get,set
        member val SuccessButtonText:String = null with get,set
        member val ActionId:Int32 = new Int32() with get,set
        member val InitialDelayInSeconds:Int32 = new Int32() with get,set
        member val MaxDisplayCount:Nullable<Int32> = new Nullable<Int32>() with get,set
        member val ValidFrom:DateTimeOffset = new DateTimeOffset() with get,set
        member val ValidTo:DateTimeOffset = new DateTimeOffset() with get,set
        member val Action:IncentiveActionResponse = null with get,set
        member val Payload:String = null with get,set
        [<ApiMember>]
        member val Body:String = null with get,set

        [<ApiMember(IsRequired=true)>]
        member val Frequency:IncentiveRecurrenceFrequency = new IncentiveRecurrenceFrequency() with get,set

        [<ApiMember(IsRequired=true)>]
        member val InitialDeferredDays:Int32 = new Int32() with get,set

        [<ApiMember>]
        member val RecurrenceInterval:UInt32 = new UInt32() with get,set

        [<ApiMember>]
        member val Active:Boolean = new Boolean() with get,set

        member val CompanyIds:ResizeArray<Guid> = new ResizeArray<Guid>() with get,set
        member val Criteria:ResizeArray<IncentiveCriteriaDto> = new ResizeArray<IncentiveCriteriaDto>() with get,set

    [<AllowNullLiteral>]
    type IncentiveCriteria() = 
        inherit BaseModel()
        member val Id:Int32 = new Int32() with get,set
        member val IncentiveId:Int32 = new Int32() with get,set
        member val CriteriaType:CriteriaType = new CriteriaType() with get,set
        member val Value:String = null with get,set
        member val InvertCondition:Boolean = new Boolean() with get,set
        member val CreatedDate:DateTimeOffset = new DateTimeOffset() with get,set

    [<AllowNullLiteral>]
    type AdminIncentiveQueryResponse() = 
        inherit CompanyIncentiveResponse()
        member val Frequency:IncentiveRecurrenceFrequency = new IncentiveRecurrenceFrequency() with get,set
        member val RecurrenceInterval:UInt32 = new UInt32() with get,set
        member val CreatedDate:DateTimeOffset = new DateTimeOffset() with get,set
        member val ModifiedDate:DateTimeOffset = new DateTimeOffset() with get,set
        member val CompanyIds:ResizeArray<Guid> = new ResizeArray<Guid>() with get,set
        member val Criteria:ResizeArray<IncentiveCriteria> = new ResizeArray<IncentiveCriteria>() with get,set
        member val ApplyToAllCompanies:Boolean = new Boolean() with get,set
        member val Action:IncentiveActionResponse = null with get,set

    [<ValidateRequest(Validator="IsAuthenticated")>]
    [<ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)>]
    [<AllowNullLiteral>]
    type CreateIncentive() = 
        [<ApiMember(IsRequired=true)>]
        member val Heading:String = null with get,set

        [<ApiMember>]
        member val StorageUrl:String = null with get,set

        [<ApiMember>]
        member val Body:String = null with get,set

        [<ApiMember(IsRequired=true)>]
        member val SuccessButtonText:String = null with get,set

        [<ApiMember(IsRequired=true)>]
        member val ActionId:Int32 = new Int32() with get,set

        [<ApiMember(IsRequired=true)>]
        member val Frequency:IncentiveRecurrenceFrequency = new IncentiveRecurrenceFrequency() with get,set

        [<ApiMember>]
        member val RecurrenceInterval:UInt32 = new UInt32() with get,set

        [<ApiMember(IsRequired=true)>]
        member val InitialDelayInSeconds:Int32 = new Int32() with get,set

        [<ApiMember(IsRequired=true)>]
        member val MaxDisplayCount:Nullable<Int32> = new Nullable<Int32>() with get,set

        [<ApiMember(IsRequired=true)>]
        member val ValidFrom:DateTimeOffset = new DateTimeOffset() with get,set

        [<ApiMember(IsRequired=true)>]
        member val ValidTo:DateTimeOffset = new DateTimeOffset() with get,set

        [<ApiMember>]
        member val Active:Boolean = new Boolean() with get,set

        [<ApiMember>]
        member val Payload:String = null with get,set

        member val CompanyIds:ResizeArray<Guid> = new ResizeArray<Guid>() with get,set
        member val Criteria:ResizeArray<IncentiveCriteriaDto> = new ResizeArray<IncentiveCriteriaDto>() with get,set
        ///<summary>
        ///Number of days to wait after first display attempt before displaying the incentive. Set to 0 to show immediately.
        ///</summary>
        [<ApiMember(Description="Number of days to wait after first display attempt before displaying the incentive. Set to 0 to show immediately.", IsRequired=true)>]
        member val InitialDeferredDays:Int32 = new Int32() with get,set

F# 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
		}
	]
}