BokaMera.API.Host

<back to all web services

LicenseInformationQuery

The following routes are available for this service:
GET/licenses/information/Get whats included in each licenseThis service is used to get to summare of information about whats included in each license.
import Foundation
import ServiceStack

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
public class LicenseInformationQuery : QueryDb2<LicenseInformation, LicenseTypeQueryResponse>
{
    /**
    * If you want to include the connected license prices
    */
    // @ApiMember(DataType="boolean", Description="If you want to include the connected license prices", ParameterType="query")
    public var includeLicensePrices:Bool

    public var responseStatus:ResponseStatus

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

    private enum CodingKeys : String, CodingKey {
        case includeLicensePrices
        case responseStatus
    }

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

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

public class LicenseInformation : BaseModel
{
    // @Ignore()
    public var prices:IList<LicensePrice>

    public var id:Int
    public var licenseInformationId:Int
    // @Required()
    public var name:String?

    // @Required()
    public var Description:String?

    public var url:String
    // @Required()
    public var freeEdition:Bool?

    public var freeEditionValue:String
    // @Required()
    public var startEdition:Bool?

    public var startEditionValue:String
    public var smartEdition:Bool?
    public var smartEditionValue:String
    // @Required()
    public var proEdition:Bool?

    public var proEditionValue:String
    public var enterpriseEdition:Bool?
    public var enterpriseEditionValue:String
    public var modifiedDate:Date?

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

    private enum CodingKeys : String, CodingKey {
        case prices
        case id
        case licenseInformationId
        case name
        case Description
        case url
        case freeEdition
        case freeEditionValue
        case startEdition
        case startEditionValue
        case smartEdition
        case smartEditionValue
        case proEdition
        case proEditionValue
        case enterpriseEdition
        case enterpriseEditionValue
        case modifiedDate
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        prices = try container.decodeIfPresent(IList<LicensePrice>.self, forKey: .prices)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        licenseInformationId = try container.decodeIfPresent(Int.self, forKey: .licenseInformationId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        url = try container.decodeIfPresent(String.self, forKey: .url)
        freeEdition = try container.decodeIfPresent(Bool.self, forKey: .freeEdition)
        freeEditionValue = try container.decodeIfPresent(String.self, forKey: .freeEditionValue)
        startEdition = try container.decodeIfPresent(Bool.self, forKey: .startEdition)
        startEditionValue = try container.decodeIfPresent(String.self, forKey: .startEditionValue)
        smartEdition = try container.decodeIfPresent(Bool.self, forKey: .smartEdition)
        smartEditionValue = try container.decodeIfPresent(String.self, forKey: .smartEditionValue)
        proEdition = try container.decodeIfPresent(Bool.self, forKey: .proEdition)
        proEditionValue = try container.decodeIfPresent(String.self, forKey: .proEditionValue)
        enterpriseEdition = try container.decodeIfPresent(Bool.self, forKey: .enterpriseEdition)
        enterpriseEditionValue = try container.decodeIfPresent(String.self, forKey: .enterpriseEditionValue)
        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 prices != nil { try container.encode(prices, forKey: .prices) }
        if id != nil { try container.encode(id, forKey: .id) }
        if licenseInformationId != nil { try container.encode(licenseInformationId, forKey: .licenseInformationId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if url != nil { try container.encode(url, forKey: .url) }
        if freeEdition != nil { try container.encode(freeEdition, forKey: .freeEdition) }
        if freeEditionValue != nil { try container.encode(freeEditionValue, forKey: .freeEditionValue) }
        if startEdition != nil { try container.encode(startEdition, forKey: .startEdition) }
        if startEditionValue != nil { try container.encode(startEditionValue, forKey: .startEditionValue) }
        if smartEdition != nil { try container.encode(smartEdition, forKey: .smartEdition) }
        if smartEditionValue != nil { try container.encode(smartEditionValue, forKey: .smartEditionValue) }
        if proEdition != nil { try container.encode(proEdition, forKey: .proEdition) }
        if proEditionValue != nil { try container.encode(proEditionValue, forKey: .proEditionValue) }
        if enterpriseEdition != nil { try container.encode(enterpriseEdition, forKey: .enterpriseEdition) }
        if enterpriseEditionValue != nil { try container.encode(enterpriseEditionValue, forKey: .enterpriseEditionValue) }
        if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) }
    }
}

public class BaseModel : Codable
{
    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 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 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 AccessKeyTypeResponse : Codable
{
    public var id:Int
    public var keyType:String
    public var Description:String

    required public init(){}
}


Swift LicenseInformationQuery 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.

GET /licenses/information/ HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QueryResponseOfLicenseTypeQueryResponseWg5EthtI xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Offset>0</Offset>
  <Total>0</Total>
  <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
    <d2p1:LicenseTypeQueryResponse>
      <d2p1:Description>String</d2p1:Description>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:IsExtraLicenseOption>false</d2p1:IsExtraLicenseOption>
      <d2p1:Items>
        <d2p1:LicenseItemsResponse>
          <d2p1:AllowedItems>0</d2p1:AllowedItems>
          <d2p1:Id>0</d2p1:Id>
          <d2p1:Name>String</d2p1:Name>
        </d2p1:LicenseItemsResponse>
      </d2p1:Items>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:PeriodOfNoticeDays>0</d2p1:PeriodOfNoticeDays>
      <d2p1:Prices xmlns:d4p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Db">
        <d4p1:LicensePrice>
          <d4p1:Country>
            <d4p1:Culture>String</d4p1:Culture>
            <d4p1:CurrencyId>String</d4p1:CurrencyId>
            <d4p1:CurrencyInfo>
              <d4p1:Active>false</d4p1:Active>
              <d4p1:CurrencySign>String</d4p1:CurrencySign>
              <d4p1:Id>String</d4p1:Id>
              <d4p1:ModifiedDate xmlns:d8p1="http://schemas.datacontract.org/2004/07/System">
                <d8p1:DateTime>0001-01-01T00:00:00Z</d8p1:DateTime>
                <d8p1:OffsetMinutes>0</d8p1:OffsetMinutes>
              </d4p1:ModifiedDate>
              <d4p1:Name>String</d4p1:Name>
            </d4p1:CurrencyInfo>
            <d4p1:Id>String</d4p1:Id>
            <d4p1:ModifiedDate xmlns:d7p1="http://schemas.datacontract.org/2004/07/System">
              <d7p1:DateTime>0001-01-01T00:00:00Z</d7p1:DateTime>
              <d7p1:OffsetMinutes>0</d7p1:OffsetMinutes>
            </d4p1:ModifiedDate>
            <d4p1:Name>String</d4p1:Name>
            <d4p1:TimeZone>String</d4p1:TimeZone>
          </d4p1:Country>
          <d4p1:CountryId>String</d4p1:CountryId>
          <d4p1:LicenseTypeId>0</d4p1:LicenseTypeId>
          <d4p1:ModifiedDate xmlns:d6p1="http://schemas.datacontract.org/2004/07/System">
            <d6p1:DateTime>0001-01-01T00:00:00Z</d6p1:DateTime>
            <d6p1:OffsetMinutes>0</d6p1:OffsetMinutes>
          </d4p1:ModifiedDate>
          <d4p1:Price>0</d4p1:Price>
        </d4p1:LicensePrice>
      </d2p1:Prices>
    </d2p1:LicenseTypeQueryResponse>
  </Results>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <ResponseStatus>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StackTrace>String</StackTrace>
    <Errors>
      <ResponseError>
        <ErrorCode>String</ErrorCode>
        <FieldName>String</FieldName>
        <Message>String</Message>
        <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Meta>
      </ResponseError>
    </Errors>
    <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Meta>
  </ResponseStatus>
</QueryResponseOfLicenseTypeQueryResponseWg5EthtI>