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:IncentiveActionResponse
public var payload:String
// @ApiMember()
public var body:String
// @ApiMember(IsRequired=true)
public var frequency:IncentiveRecurrenceFrequency
// @ApiMember(IsRequired=true)
public var initialDeferredDays:Int
// @ApiMember()
public var recurrenceInterval:UInt32
// @ApiMember()
public var active:Bool
public var companyIds:[String] = []
public var criteria:[IncentiveCriteriaDto] = []
required public init(){}
}
public class IncentiveActionResponse : Codable
{
public var id:Int
public var Description:String
public var actionType:IncentiveActionType
public var page:String
public var segment:String
public var element:String
public var licenseTypeId:Int?
public var suggestedLicenseToUpgrade:LicenseTypeQueryResponse
required public init(){}
}
public enum IncentiveActionType : Int, Codable
{
case Upgrade = 1
case AddOn = 2
case Information = 3
}
public class LicenseTypeQueryResponse : Codable
{
/**
* The license type id
*/
// @ApiMember(Description="The license type id")
public var id:Int
/**
* The license type name
*/
// @ApiMember(Description="The license type name")
public var name:String
/**
* The license type description
*/
// @ApiMember(Description="The license type description")
public var Description:String
/**
* 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.")
public var isExtraLicenseOption:Bool
/**
* The period of notice for the license in days.
*/
// @ApiMember(Description="The period of notice for the license in days.")
public var periodOfNoticeDays:Int
/**
* The license items for the license type
*/
// @ApiMember(Description="The license items for the license type")
public var items:[LicenseItemsResponse] = []
/**
* The license prices in each country for the license type
*/
// @ApiMember(Description="The license prices in each country for the license type")
public var prices:[LicensePrice] = []
required public init(){}
}
public class LicenseItemsResponse : Codable
{
public var id:Int
public var name:String
public var allowedItems:Int
required public init(){}
}
public class LicensePrice : BaseModel
{
// @Ignore()
public var country:Country
// @Ignore()
public var monthlyPayment:Bool
// @Required()
public var licenseTypeId:Int?
// @Required()
public var countryId:String?
// @Required()
public var price:Int?
public var modifiedDate:Date?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case country
case monthlyPayment
case licenseTypeId
case countryId
case price
case modifiedDate
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
country = try container.decodeIfPresent(Country.self, forKey: .country)
monthlyPayment = try container.decodeIfPresent(Bool.self, forKey: .monthlyPayment)
licenseTypeId = try container.decodeIfPresent(Int.self, forKey: .licenseTypeId)
countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
price = try container.decodeIfPresent(Int.self, forKey: .price)
modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if country != nil { try container.encode(country, forKey: .country) }
if monthlyPayment != nil { try container.encode(monthlyPayment, forKey: .monthlyPayment) }
if licenseTypeId != nil { try container.encode(licenseTypeId, forKey: .licenseTypeId) }
if countryId != nil { try container.encode(countryId, forKey: .countryId) }
if price != nil { try container.encode(price, forKey: .price) }
if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
}
}
public class BaseModel : Codable
{
required public init(){}
}
public class Country : BaseModel
{
// @References(typeof(Currency))
public var currencyId:String
public var currencyInfo:Currency
// @Required()
public var name:String?
public var culture:String
public var timeZone:String
public var modifiedDate:Date?
// @Required()
public var id:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case currencyId
case currencyInfo
case name
case culture
case timeZone
case modifiedDate
case id
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
currencyId = try container.decodeIfPresent(String.self, forKey: .currencyId)
currencyInfo = try container.decodeIfPresent(Currency.self, forKey: .currencyInfo)
name = try container.decodeIfPresent(String.self, forKey: .name)
culture = try container.decodeIfPresent(String.self, forKey: .culture)
timeZone = try container.decodeIfPresent(String.self, forKey: .timeZone)
modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
id = try container.decodeIfPresent(String.self, forKey: .id)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if currencyId != nil { try container.encode(currencyId, forKey: .currencyId) }
if currencyInfo != nil { try container.encode(currencyInfo, forKey: .currencyInfo) }
if name != nil { try container.encode(name, forKey: .name) }
if culture != nil { try container.encode(culture, forKey: .culture) }
if timeZone != nil { try container.encode(timeZone, forKey: .timeZone) }
if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
if id != nil { try container.encode(id, forKey: .id) }
}
}
public class Currency : BaseModel
{
// @Required()
public var name:String?
// @Required()
public var currencySign:String?
// @Required()
public var active:Bool?
public var modifiedDate:Date?
// @Required()
public var id:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case name
case currencySign
case active
case modifiedDate
case id
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
name = try container.decodeIfPresent(String.self, forKey: .name)
currencySign = try container.decodeIfPresent(String.self, forKey: .currencySign)
active = try container.decodeIfPresent(Bool.self, forKey: .active)
modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
id = try container.decodeIfPresent(String.self, forKey: .id)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if name != nil { try container.encode(name, forKey: .name) }
if currencySign != nil { try container.encode(currencySign, forKey: .currencySign) }
if active != nil { try container.encode(active, forKey: .active) }
if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
if id != nil { try container.encode(id, forKey: .id) }
}
}
public enum IncentiveRecurrenceFrequency : Int, Codable
{
case OneTime = 1
case Weekly = 2
case Monthly = 3
}
public class IncentiveCriteriaDto : Codable
{
public var criteriaType:CriteriaType
public var value:String
public var invertCondition:Bool
required public init(){}
}
public enum CriteriaType : String, Codable
{
case LicenseAvailability
case SmsActivation
case eAccountingActivation
case CodeLockActivation
case SocialActivation
case OnlinePaymentActivation
case FollowUpMessageActivation
case RatingActivation
}
Swift CompanyIncentiveQuery DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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: api.bookmore.com Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {}