GET | /licenses/types/ | Get all license types | This service is used to get get all license types that exists. |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
public class LicenseTypeQuery : QueryDb2<LicenseType, LicenseInformationQueryResponse>
{
/**
* If you want to only select Extra license options
*/
// @ApiMember(DataType="boolean", Description="If you want to only select Extra license options", ParameterType="query")
public var extraLicenseOption:Bool?
/**
* What country you want to list the prices for
*/
// @ApiMember(DataType="string", Description="What country you want to list the prices for")
public var countryId:String
/**
* If you want to include the connected license items
*/
// @ApiMember(DataType="boolean", Description="If you want to include the connected license items", ParameterType="query")
public var includeLicenseItems:Bool
/**
* If you want to include the connected licens prices
*/
// @ApiMember(DataType="boolean", Description="If you want to include the connected licens prices", ParameterType="query")
public var includeLicensePrices:Bool
public var responseStatus:ResponseStatus
public var active:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case extraLicenseOption
case countryId
case includeLicenseItems
case includeLicensePrices
case responseStatus
case active
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
extraLicenseOption = try container.decodeIfPresent(Bool.self, forKey: .extraLicenseOption)
countryId = try container.decodeIfPresent(String.self, forKey: .countryId)
includeLicenseItems = try container.decodeIfPresent(Bool.self, forKey: .includeLicenseItems)
includeLicensePrices = try container.decodeIfPresent(Bool.self, forKey: .includeLicensePrices)
responseStatus = try container.decodeIfPresent(ResponseStatus.self, forKey: .responseStatus)
active = try container.decodeIfPresent(Bool.self, forKey: .active)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if extraLicenseOption != nil { try container.encode(extraLicenseOption, forKey: .extraLicenseOption) }
if countryId != nil { try container.encode(countryId, forKey: .countryId) }
if includeLicenseItems != nil { try container.encode(includeLicenseItems, forKey: .includeLicenseItems) }
if includeLicensePrices != nil { try container.encode(includeLicensePrices, forKey: .includeLicensePrices) }
if responseStatus != nil { try container.encode(responseStatus, forKey: .responseStatus) }
if active != nil { try container.encode(active, forKey: .active) }
}
}
public class LicenseType : BaseModel
{
// @Ignore()
public var licenseItems:IList<LicenseTypeItem>
// @Ignore()
public var prices:IList<LicensePrice>
// @Ignore()
public var periodOfNoticeDays:Int
// @Ignore()
public var nextLicenseOption:LicenseType
// @Required()
public var name:String?
// @Required()
public var Description:String?
// @Required()
public var extraLicenseOption:Bool?
public var modifiedDate:Date?
public var active:Bool
public var id:Int
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case licenseItems
case prices
case periodOfNoticeDays
case nextLicenseOption
case name
case Description
case extraLicenseOption
case modifiedDate
case active
case id
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
licenseItems = try container.decodeIfPresent(IList<LicenseTypeItem>.self, forKey: .licenseItems)
prices = try container.decodeIfPresent(IList<LicensePrice>.self, forKey: .prices)
periodOfNoticeDays = try container.decodeIfPresent(Int.self, forKey: .periodOfNoticeDays)
nextLicenseOption = try container.decodeIfPresent(LicenseType.self, forKey: .nextLicenseOption)
name = try container.decodeIfPresent(String.self, forKey: .name)
Description = try container.decodeIfPresent(String.self, forKey: .Description)
extraLicenseOption = try container.decodeIfPresent(Bool.self, forKey: .extraLicenseOption)
modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate)
active = try container.decodeIfPresent(Bool.self, forKey: .active)
id = try container.decodeIfPresent(Int.self, forKey: .id)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if licenseItems != nil { try container.encode(licenseItems, forKey: .licenseItems) }
if prices != nil { try container.encode(prices, forKey: .prices) }
if periodOfNoticeDays != nil { try container.encode(periodOfNoticeDays, forKey: .periodOfNoticeDays) }
if nextLicenseOption != nil { try container.encode(nextLicenseOption, forKey: .nextLicenseOption) }
if name != nil { try container.encode(name, forKey: .name) }
if Description != nil { try container.encode(Description, forKey: .Description) }
if extraLicenseOption != nil { try container.encode(extraLicenseOption, forKey: .extraLicenseOption) }
if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
if active != nil { try container.encode(active, forKey: .active) }
if id != nil { try container.encode(id, forKey: .id) }
}
}
public class BaseModel : Codable
{
required public init(){}
}
public class LicenseTypeItem : BaseModel
{
// @Ignore()
public var name:String
// @Ignore()
public var licenseType:LicenseType
// @Required()
public var licenseTypesId:Int?
// @Required()
public var licenseItemsId:Int?
// @Required()
public var numberOfItems:Int?
public var id:Int
public var modifiedDate:Date?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case name
case licenseType
case licenseTypesId
case licenseItemsId
case numberOfItems
case id
case modifiedDate
}
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)
licenseType = try container.decodeIfPresent(LicenseType.self, forKey: .licenseType)
licenseTypesId = try container.decodeIfPresent(Int.self, forKey: .licenseTypesId)
licenseItemsId = try container.decodeIfPresent(Int.self, forKey: .licenseItemsId)
numberOfItems = try container.decodeIfPresent(Int.self, forKey: .numberOfItems)
id = try container.decodeIfPresent(Int.self, forKey: .id)
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 name != nil { try container.encode(name, forKey: .name) }
if licenseType != nil { try container.encode(licenseType, forKey: .licenseType) }
if licenseTypesId != nil { try container.encode(licenseTypesId, forKey: .licenseTypesId) }
if licenseItemsId != nil { try container.encode(licenseItemsId, forKey: .licenseItemsId) }
if numberOfItems != nil { try container.encode(numberOfItems, forKey: .numberOfItems) }
if id != nil { try container.encode(id, forKey: .id) }
if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
}
}
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 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 class LicenseInformationQueryResponse : Codable
{
public var name:String
public var Description:String
public var url:Uri
public var freeEdition:Bool
public var startEdition:Bool
public var proEdition:Bool
public var smartEdition:Bool
public var enterpriseEdition:Bool
public var freeEditionValue:String
public var startEditionValue:String
public var proEditionValue:String
public var smartEditionValue:String
public var enterpriseEditionValue:String
public var licenseInformationTypeId:Int
required public init(){}
}
public class AccessKeyTypeResponse : Codable
{
public var id:Int
public var keyType:String
public var Description:String
required public init(){}
}
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 /licenses/types/ HTTP/1.1 Host: api.bokamera.se Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Offset":0,"Total":0,"Results":[{"Name":"String","Description":"String","FreeEdition":false,"StartEdition":false,"ProEdition":false,"SmartEdition":false,"EnterpriseEdition":false,"FreeEditionValue":"String","StartEditionValue":"String","ProEditionValue":"String","SmartEditionValue":"String","EnterpriseEditionValue":"String","LicenseInformationTypeId":0}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}