/* Options: Date: 2024-11-21 11:58:32 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: CustomerCommentsQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/customers/{CustomerId}/comments", "GET") // @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400) // @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class CustomerCommentsQuery : QueryDb2, IReturn, ICompany { public typealias Return = QueryResponse // @ApiMember(IsRequired=true) public var customerId:String // @ApiMember(IsRequired=true) public var companyId:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case customerId case companyId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) customerId = try container.decodeIfPresent(String.self, forKey: .customerId) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if customerId != nil { try container.encode(customerId, forKey: .customerId) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } } } public protocol ICompany { var companyId:String? { get set } } public class CustomerComment : BaseModel { // @Required() public var companyId:String? public var id:Int // @Required() public var customerId:String? // @Required() public var comments:String? // @Required() public var updated:Date? // @Required() public var created:Date? public var imageUrl:String public var modifiedDate:Date? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case id case customerId case comments case updated case created case imageUrl case modifiedDate } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) id = try container.decodeIfPresent(Int.self, forKey: .id) customerId = try container.decodeIfPresent(String.self, forKey: .customerId) comments = try container.decodeIfPresent(String.self, forKey: .comments) updated = try container.decodeIfPresent(Date.self, forKey: .updated) created = try container.decodeIfPresent(Date.self, forKey: .created) imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl) 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 companyId != nil { try container.encode(companyId, forKey: .companyId) } if id != nil { try container.encode(id, forKey: .id) } if customerId != nil { try container.encode(customerId, forKey: .customerId) } if comments != nil { try container.encode(comments, forKey: .comments) } if updated != nil { try container.encode(updated, forKey: .updated) } if created != nil { try container.encode(created, forKey: .created) } if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } } } public class BaseModel : Codable { required public init(){} } public class CustomerCommentsResponse : Codable { public var id:Int public var customerId:String public var comments:String public var updated:Date public var created:Date public var imageUrl:Uri required public init(){} }