/* Options: Date: 2024-11-21 17:27:49 SwiftVersion: 5.0 Version: 6.111 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://northwind.netcore.io //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: QueryCustomers.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/query/customers") public class QueryCustomers : QueryDb, IReturn { public typealias Return = QueryResponse public var ids:[String] public var countryStartsWith:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case ids case countryStartsWith } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) ids = try container.decodeIfPresent([String].self, forKey: .ids) ?? [] countryStartsWith = try container.decodeIfPresent(String.self, forKey: .countryStartsWith) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if ids.count > 0 { try container.encode(ids, forKey: .ids) } if countryStartsWith != nil { try container.encode(countryStartsWith, forKey: .countryStartsWith) } } } // @DataContract public class Customer : Codable { // @DataMember public var id:String // @DataMember public var companyName:String // @DataMember public var contactName:String // @DataMember public var contactTitle:String // @DataMember public var address:String // @DataMember public var city:String // @DataMember public var region:String // @DataMember public var postalCode:String // @DataMember public var country:String // @DataMember public var phone:String // @DataMember public var fax:String required public init(){} }