/* Options: Date: 2024-11-23 08:55:25 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: TrialsQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/trials", "GET") // @ValidateRequest(Validator="IsAuthenticated") public class TrialsQuery : QueryDb2, IReturn { public typealias Return = QueryResponse /** * Trial Id */ // @ApiMember(Description="Trial Id", IsRequired=true, ParameterType="query") public var id:Int? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case id } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) 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 id != nil { try container.encode(id, forKey: .id) } } } public class TrialType : BaseModel { // @Required() public var name:String? // @Required() public var days:Int? public var modifiedDate:Date? public var id:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case name case days 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) days = try container.decodeIfPresent(Int.self, forKey: .days) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) 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 name != nil { try container.encode(name, forKey: .name) } if days != nil { try container.encode(days, forKey: .days) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if id != nil { try container.encode(id, forKey: .id) } } } public class TrialQueryResponse : Codable { public var id:Int public var name:String public var trialDays:Int required public init(){} } public class BaseModel : Codable { required public init(){} }