BusinessApi

<back to all web services

UpdateAdRequest

Business
Requires Authentication
Required role:Business
The following routes are available for this service:
PUT/ad/update
import Foundation
import ServiceStack

public class AdDetailsUnion : Codable
{
    public var percentageOnAllMerchandise:AdDetailsPercentageDiscountOnAllMerchandise
    public var percentageRangeOnAllMerchandise:AdDetailsPercentageDiscountRangeOnAllMerchandise
    public var percentageOnSelectedMerchandise:AdDetailsPercentageDiscountOnSelectedMerchandise
    public var absoluteOnSelectedMerchandise:AdDetailsAbsoluteDiscountOnSelectedMerchandise
    public var absoluteRangeOnAllMerchandise:AdDetailsAbsoluteDiscountRangeOnAllMerchandise
    public var totalAmountOverXgivesYdiscount:AdDetailsTotalAmountOverXgivesYdiscount
    public var xforY:AdDetailsXforYdiscount
    public var newArrivals:AdDetailsNewArrivals
    public var freetext:AdDetailsFreetext
    public var todaysBreakFastOffer:AdDetailsTodaysBreakFastOffer
    public var todaysLunchOffer:AdDetailsTodaysLunchOffer
    public var todaysDinnerOffer:AdDetailsTodaysDinnerOffer
    public var saveFoodAndMoney:AdDetailsSaveFoodAndMoney
    public var percentageOfYourFoodBill:AdDetailsPercentageOffYourFoodBill
    public var happyHour:AdDetailsHappyHour
    public var someFreeTablesLeftToday:AdDetailsSomeFreeTablesLeftToday
    public var twoDishesForThePriceOfOne:AdDetailsTwoDishesForThePriceOfOne

    required public init(){}
}

public class AdDetailsPercentageDiscountOnAllMerchandise : AdDetailsBase
{
    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 AdDetailsBase : Codable
{
    public var Description:String
    public var moreInformation:[String] = []

    required public init(){}
}

public class AdDetailsPercentageDiscountRangeOnAllMerchandise : AdDetailsBase
{
    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 AdDetailsPercentageDiscountOnSelectedMerchandise : AdDetailsBase
{
    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 AdDetailsAbsoluteDiscountOnSelectedMerchandise : AdDetailsBase
{
    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 AdDetailsAbsoluteDiscountRangeOnAllMerchandise : AdDetailsBase
{
    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 AdDetailsTotalAmountOverXgivesYdiscount : AdDetailsBase
{
    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 AdDetailsXforYdiscount : AdDetailsBase
{
    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 AdDetailsNewArrivals : AdDetailsBase
{
    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 AdDetailsFreetext : AdDetailsBase
{
    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 AdDetailsTodaysBreakFastOffer : AdDetailsBase
{
    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 AdDetailsTodaysLunchOffer : AdDetailsBase
{
    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 AdDetailsTodaysDinnerOffer : AdDetailsBase
{
    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 AdDetailsSaveFoodAndMoney : AdDetailsBase
{
    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 AdDetailsPercentageOffYourFoodBill : AdDetailsBase
{
    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 AdDetailsHappyHour : AdDetailsBase
{
    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 AdDetailsSomeFreeTablesLeftToday : AdDetailsBase
{
    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 AdDetailsTwoDishesForThePriceOfOne : AdDetailsBase
{
    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 UpdateAdRequest DTOs

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

HTTP + XML

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

PUT /ad/update HTTP/1.1 
Host: qa-business-api.brovs.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UpdateAdRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BusinessApi.Dto">
  <AdId>0</AdId>
  <DetailsUnion xmlns:d2p1="http://schemas.datacontract.org/2004/07/Entities.Common">
    <d2p1:AbsoluteOnSelectedMerchandise>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Value>0</d2p1:Value>
    </d2p1:AbsoluteOnSelectedMerchandise>
    <d2p1:AbsoluteRangeOnAllMerchandise>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Start>0</d2p1:Start>
      <d2p1:Stop>0</d2p1:Stop>
    </d2p1:AbsoluteRangeOnAllMerchandise>
    <d2p1:Freetext>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Title>String</d2p1:Title>
    </d2p1:Freetext>
    <d2p1:HappyHour>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
    </d2p1:HappyHour>
    <d2p1:NewArrivals>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
    </d2p1:NewArrivals>
    <d2p1:PercentageOfYourFoodBill>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Percentage>0</d2p1:Percentage>
    </d2p1:PercentageOfYourFoodBill>
    <d2p1:PercentageOnAllMerchandise>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Value>0</d2p1:Value>
    </d2p1:PercentageOnAllMerchandise>
    <d2p1:PercentageOnSelectedMerchandise>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Value>0</d2p1:Value>
    </d2p1:PercentageOnSelectedMerchandise>
    <d2p1:PercentageRangeOnAllMerchandise>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Start>0</d2p1:Start>
      <d2p1:Stop>0</d2p1:Stop>
    </d2p1:PercentageRangeOnAllMerchandise>
    <d2p1:SaveFoodAndMoney>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Value>0</d2p1:Value>
    </d2p1:SaveFoodAndMoney>
    <d2p1:SomeFreeTablesLeftToday>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
    </d2p1:SomeFreeTablesLeftToday>
    <d2p1:TodaysBreakFastOffer>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Value>0</d2p1:Value>
    </d2p1:TodaysBreakFastOffer>
    <d2p1:TodaysDinnerOffer>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Value>0</d2p1:Value>
    </d2p1:TodaysDinnerOffer>
    <d2p1:TodaysLunchOffer>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:Value>0</d2p1:Value>
    </d2p1:TodaysLunchOffer>
    <d2p1:TotalAmountOverXgivesYdiscount>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:IfTotalAmountMoreThanX>0</d2p1:IfTotalAmountMoreThanX>
      <d2p1:ThenYouGetDiscountPercentageY>0</d2p1:ThenYouGetDiscountPercentageY>
    </d2p1:TotalAmountOverXgivesYdiscount>
    <d2p1:TwoDishesForThePriceOfOne>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
    </d2p1:TwoDishesForThePriceOfOne>
    <d2p1:XforY>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:MoreInformation xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:string>String</d4p1:string>
      </d2p1:MoreInformation>
      <d2p1:IfYouBuyX>0</d2p1:IfYouBuyX>
      <d2p1:ThenYouGetY>0</d2p1:ThenYouGetY>
    </d2p1:XforY>
  </DetailsUnion>
  <PublishAt>
    <Day>0</Day>
    <Hour>0</Hour>
    <Minute>0</Minute>
    <Month>0</Month>
    <Second>0</Second>
    <Year>0</Year>
  </PublishAt>
  <StartAt>
    <Day>0</Day>
    <Hour>0</Hour>
    <Minute>0</Minute>
    <Month>0</Month>
    <Second>0</Second>
    <Year>0</Year>
  </StartAt>
  <StopAt>
    <Day>0</Day>
    <Hour>0</Hour>
    <Minute>0</Minute>
    <Month>0</Month>
    <Second>0</Second>
    <Year>0</Year>
  </StopAt>
</UpdateAdRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<UpdateAdResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BusinessApi.Dto">
  <AdId>0</AdId>
</UpdateAdResponse>