/* Options: Date: 2024-11-21 12:58:42 SwiftVersion: 5.0 Version: 8.23 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://api.bokamera.se //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: GeoDataCitiesQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/geodata/{CountryId}/cities/", "GET") public class GeoDataCitiesQuery : QueryDb2, IReturn { public typealias Return = QueryResponse /** * Enter the country id you want to search cities. Example SE for Sweden. */ // @ApiMember(Description="Enter the country id you want to search cities. Example SE for Sweden.", IsRequired=true, ParameterType="path") public var countryId:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case countryId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) countryId = try container.decodeIfPresent(String.self, forKey: .countryId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if countryId != nil { try container.encode(countryId, forKey: .countryId) } } } public class City : BaseModel { // @Ignore() public var longitude:Double // @Ignore() public var latitude:Double // @Required() public var name:String? // @Required() public var country:String? public var iso2:String // @Required() public var admin:String? public var capital:String public var population:Int? public var populationProper:Int? public var modifiedDate:Date? // @Required() public var id:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case longitude case latitude case name case country case iso2 case admin case capital case population case populationProper case modifiedDate case id } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) longitude = try container.decodeIfPresent(Double.self, forKey: .longitude) latitude = try container.decodeIfPresent(Double.self, forKey: .latitude) name = try container.decodeIfPresent(String.self, forKey: .name) country = try container.decodeIfPresent(String.self, forKey: .country) iso2 = try container.decodeIfPresent(String.self, forKey: .iso2) admin = try container.decodeIfPresent(String.self, forKey: .admin) capital = try container.decodeIfPresent(String.self, forKey: .capital) population = try container.decodeIfPresent(Int.self, forKey: .population) populationProper = try container.decodeIfPresent(Int.self, forKey: .populationProper) 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 longitude != nil { try container.encode(longitude, forKey: .longitude) } if latitude != nil { try container.encode(latitude, forKey: .latitude) } if name != nil { try container.encode(name, forKey: .name) } if country != nil { try container.encode(country, forKey: .country) } if iso2 != nil { try container.encode(iso2, forKey: .iso2) } if admin != nil { try container.encode(admin, forKey: .admin) } if capital != nil { try container.encode(capital, forKey: .capital) } if population != nil { try container.encode(population, forKey: .population) } if populationProper != nil { try container.encode(populationProper, forKey: .populationProper) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if id != nil { try container.encode(id, forKey: .id) } } } public class GeoDataCitiesQueryResponse : Codable { public var id:String public var city:String public var longitude:String public var latitude:String public var country:String public var iso2:String public var admin:String public var capital:String public var population:Int? public var populationProper:Int? required public init(){} } public class BaseModel : Codable { required public init(){} }