Requires any of the roles: | bookingsupplier-administrator-write, bookingsupplier-administrator-read, superadmin |
GET | /companies/{CompanyId}/incentives | It gets either incentives which are not read or engaged by the current company/administrator. |
---|
import Foundation
import ServiceStack
// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
public class CompanyIncentiveQuery : ICompany, Codable
{
/**
* The company id, if empty will use the company id for the user you are logged in with.
*/
// @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.", IsRequired=true, ParameterType="path")
public var companyId:String?
required public init(){}
}
public class CompanyIncentivesQueryResponse : Codable
{
public var incentives:IList<CompanyIncentiveResponse>
public var companyId:String
required public init(){}
}
public class CompanyIncentiveResponse : Codable
{
public var id:Int
public var heading:String
public var storageUrl:String
public var successButtonText:String
public var actionId:Int
public var initialDelayInSeconds:Int
public var maxDisplayCount:Int?
public var validFrom:Date
public var validTo:Date
public var action:IncentiveAction
public var payload:String
required public init(){}
}
public class IncentiveAction : BaseModel
{
public var id:Int
public var actionType:IncentiveActionType
public var page:String
public var segment:String
public var element:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case id
case actionType
case page
case segment
case element
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
id = try container.decodeIfPresent(Int.self, forKey: .id)
actionType = try container.decodeIfPresent(IncentiveActionType.self, forKey: .actionType)
page = try container.decodeIfPresent(String.self, forKey: .page)
segment = try container.decodeIfPresent(String.self, forKey: .segment)
element = try container.decodeIfPresent(String.self, forKey: .element)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if id != nil { try container.encode(id, forKey: .id) }
if actionType != nil { try container.encode(actionType, forKey: .actionType) }
if page != nil { try container.encode(page, forKey: .page) }
if segment != nil { try container.encode(segment, forKey: .segment) }
if element != nil { try container.encode(element, forKey: .element) }
}
}
public class BaseModel : Codable
{
required public init(){}
}
public enum IncentiveActionType : Int, Codable
{
case Upgrade = 1
case AddOn = 2
case Information = 3
}
Swift CompanyIncentiveQuery DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /companies/{CompanyId}/incentives HTTP/1.1 Host: testapi.bokamera.se Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CompanyIncentivesQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <Incentives i:nil="true" /> </CompanyIncentivesQueryResponse>