BusinessApi

<back to all web services

CreateAdMessageRequest

Business
Requires Authentication
Required role:Business
The following routes are available for this service:
POST/admessage/create
import Foundation
import ServiceStack

public class AdMessageDetailsUnion : Codable
{
    public var percentageOnAllMerchandise:AdMessageDetailsPercentageDiscountOnAllMerchandise
    public var percentageRangeOnAllMerchandise:AdMessageDetailsPercentageDiscountRangeOnAllMerchandise
    public var percentageOnSelectedMerchandise:AdMessageDetailsPercentageDiscountOnSelectedMerchandise
    public var absoluteOnSelectedMerchandise:AdMessageDetailsAbsoluteDiscountOnSelectedMerchandise
    public var absoluteRangeOnAllMerchandise:AdMessageDetailsAbsoluteDiscountRangeOnAllMerchandise
    public var totalAmountOverXgivesYdiscount:AdMessageDetailsTotalAmountOverXgivesYdiscount
    public var xforY:AdMessageDetailsXforYdiscount
    public var newArrivals:AdMessageDetailsNewArrivals
    public var freetext:AdMessageDetailsFreetext
    public var todaysBreakFastOffer:AdMessageDetailsTodaysBreakFastOffer
    public var todaysLunchOffer:AdMessageDetailsTodaysLunchOffer
    public var todaysDinnerOffer:AdMessageDetailsTodaysDinnerOffer
    public var saveFoodAndMoney:AdMessageDetailsSaveFoodAndMoney
    public var percentageOfYourFoodBill:AdMessageDetailsPercentageOffYourFoodBill
    public var happyHour:AdMessageDetailsHappyHour
    public var someFreeTablesLeftToday:AdMessageDetailsSomeFreeTablesLeftToday
    public var twoDishesForThePriceOfOne:AdMessageDetailsTwoDishesForThePriceOfOne

    required public init(){}
}

public class AdMessageDetailsPercentageDiscountOnAllMerchandise : AdMessageDetailsBase
{
    public var value:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case value
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        value = try container.decodeIfPresent(Double.self, forKey: .value)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if value != nil { try container.encode(value, forKey: .value) }
    }
}

public class AdMessageDetailsBase : Codable
{
    public var Description:String
    public var moreInformation:[String] = []

    required public init(){}
}

public class AdMessageDetailsPercentageDiscountRangeOnAllMerchandise : AdMessageDetailsBase
{
    public var start:Double
    public var stop:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case start
        case stop
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        start = try container.decodeIfPresent(Double.self, forKey: .start)
        stop = try container.decodeIfPresent(Double.self, forKey: .stop)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if start != nil { try container.encode(start, forKey: .start) }
        if stop != nil { try container.encode(stop, forKey: .stop) }
    }
}

public class AdMessageDetailsPercentageDiscountOnSelectedMerchandise : AdMessageDetailsBase
{
    public var value:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case value
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        value = try container.decodeIfPresent(Double.self, forKey: .value)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if value != nil { try container.encode(value, forKey: .value) }
    }
}

public class AdMessageDetailsAbsoluteDiscountOnSelectedMerchandise : AdMessageDetailsBase
{
    public var value:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case value
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        value = try container.decodeIfPresent(Double.self, forKey: .value)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if value != nil { try container.encode(value, forKey: .value) }
    }
}

public class AdMessageDetailsAbsoluteDiscountRangeOnAllMerchandise : AdMessageDetailsBase
{
    public var start:Double
    public var stop:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case start
        case stop
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        start = try container.decodeIfPresent(Double.self, forKey: .start)
        stop = try container.decodeIfPresent(Double.self, forKey: .stop)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if start != nil { try container.encode(start, forKey: .start) }
        if stop != nil { try container.encode(stop, forKey: .stop) }
    }
}

public class AdMessageDetailsTotalAmountOverXgivesYdiscount : AdMessageDetailsBase
{
    public var ifTotalAmountMoreThanX:Double
    public var thenYouGetDiscountPercentageY:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case ifTotalAmountMoreThanX
        case thenYouGetDiscountPercentageY
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        ifTotalAmountMoreThanX = try container.decodeIfPresent(Double.self, forKey: .ifTotalAmountMoreThanX)
        thenYouGetDiscountPercentageY = try container.decodeIfPresent(Double.self, forKey: .thenYouGetDiscountPercentageY)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if ifTotalAmountMoreThanX != nil { try container.encode(ifTotalAmountMoreThanX, forKey: .ifTotalAmountMoreThanX) }
        if thenYouGetDiscountPercentageY != nil { try container.encode(thenYouGetDiscountPercentageY, forKey: .thenYouGetDiscountPercentageY) }
    }
}

public class AdMessageDetailsXforYdiscount : AdMessageDetailsBase
{
    public var ifYouBuyX:Int
    public var thenYouGetY:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case ifYouBuyX
        case thenYouGetY
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        ifYouBuyX = try container.decodeIfPresent(Int.self, forKey: .ifYouBuyX)
        thenYouGetY = try container.decodeIfPresent(Int.self, forKey: .thenYouGetY)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if ifYouBuyX != nil { try container.encode(ifYouBuyX, forKey: .ifYouBuyX) }
        if thenYouGetY != nil { try container.encode(thenYouGetY, forKey: .thenYouGetY) }
    }
}

public class AdMessageDetailsNewArrivals : AdMessageDetailsBase
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class AdMessageDetailsFreetext : AdMessageDetailsBase
{
    public var title:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case title
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        title = try container.decodeIfPresent(String.self, forKey: .title)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if title != nil { try container.encode(title, forKey: .title) }
    }
}

public class AdMessageDetailsTodaysBreakFastOffer : AdMessageDetailsBase
{
    public var value:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case value
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        value = try container.decodeIfPresent(Double.self, forKey: .value)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if value != nil { try container.encode(value, forKey: .value) }
    }
}

public class AdMessageDetailsTodaysLunchOffer : AdMessageDetailsBase
{
    public var value:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case value
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        value = try container.decodeIfPresent(Double.self, forKey: .value)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if value != nil { try container.encode(value, forKey: .value) }
    }
}

public class AdMessageDetailsTodaysDinnerOffer : AdMessageDetailsBase
{
    public var value:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case value
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        value = try container.decodeIfPresent(Double.self, forKey: .value)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if value != nil { try container.encode(value, forKey: .value) }
    }
}

public class AdMessageDetailsSaveFoodAndMoney : AdMessageDetailsBase
{
    public var value:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case value
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        value = try container.decodeIfPresent(Double.self, forKey: .value)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if value != nil { try container.encode(value, forKey: .value) }
    }
}

public class AdMessageDetailsPercentageOffYourFoodBill : AdMessageDetailsBase
{
    public var percentage:Double

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case percentage
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        percentage = try container.decodeIfPresent(Double.self, forKey: .percentage)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if percentage != nil { try container.encode(percentage, forKey: .percentage) }
    }
}

public class AdMessageDetailsHappyHour : AdMessageDetailsBase
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class AdMessageDetailsSomeFreeTablesLeftToday : AdMessageDetailsBase
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class AdMessageDetailsTwoDishesForThePriceOfOne : AdMessageDetailsBase
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}


Swift CreateAdMessageRequest 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 /admessage/create HTTP/1.1 
Host: business-api.brovs.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	placeId: 0,
	detailsUnion: 
	{
		percentageOnAllMerchandise: 
		{
			value: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		percentageRangeOnAllMerchandise: 
		{
			start: 0,
			stop: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		percentageOnSelectedMerchandise: 
		{
			value: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		absoluteOnSelectedMerchandise: 
		{
			value: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		absoluteRangeOnAllMerchandise: 
		{
			start: 0,
			stop: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		totalAmountOverXgivesYdiscount: 
		{
			ifTotalAmountMoreThanX: 0,
			thenYouGetDiscountPercentageY: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		xforY: 
		{
			ifYouBuyX: 0,
			thenYouGetY: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		newArrivals: 
		{
			description: String,
			moreInformation: 
			[
				String
			]
		},
		freetext: 
		{
			title: String,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		todaysBreakFastOffer: 
		{
			value: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		todaysLunchOffer: 
		{
			value: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		todaysDinnerOffer: 
		{
			value: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		saveFoodAndMoney: 
		{
			value: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		percentageOfYourFoodBill: 
		{
			percentage: 0,
			description: String,
			moreInformation: 
			[
				String
			]
		},
		happyHour: 
		{
			description: String,
			moreInformation: 
			[
				String
			]
		},
		someFreeTablesLeftToday: 
		{
			description: String,
			moreInformation: 
			[
				String
			]
		},
		twoDishesForThePriceOfOne: 
		{
			description: String,
			moreInformation: 
			[
				String
			]
		}
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: 0
}