/* Options: Date: 2024-11-21 12:15:17 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: UpdateArticle.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/articles/{Id}", "PUT") public class UpdateArticle : IReturn, ICompany, Codable { public typealias Return = ArticleResponse /** * */ // @ApiMember(Description="", IsRequired=true, ParameterType="query") public var id:Int /** * */ // @ApiMember(Description="") public var companyId:String? /** * */ // @ApiMember(Description="") public var name:String /** * */ // @ApiMember(Description="") public var articleTypeId:Int? /** * */ // @ApiMember(Description="") public var Description:String /** * */ // @ApiMember(Description="") public var imageUrl:Uri /** * */ // @ApiMember(Description="") public var active:Bool? /** * */ // @ApiMember(Description="") public var amount:Int /** * . */ // @ApiMember(Description=".") public var price:Double /** * The payment currency id */ // @ApiMember(Description="The payment currency id") public var currencyId:String /** * Query for specific services. */ // @ApiMember(Description="Query for specific services.", ParameterType="query") public var serviceIds:[Int] = [] required public init(){} } public class ArticleResponse : Codable { public var companyId:String public var id:Int public var name:String public var articleTypeId:Int public var Description:String public var imageUrl:String public var active:Bool public var amount:Int public var price:Double public var currencyId:String public var updatedDate:Date public var createdDate:Date public var services:[ArticleServiceRelation] = [] public var serviceIds:[Int] = [] public var priceSign:String required public init(){} } public protocol ICompany { var companyId:String? { get set } } public class ArticleServiceRelation : BaseModel { // @Required() public var companyId:String? public var id:Int // @Required() public var serviceId:Int? // @Required() public var articleId:Int? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case id case serviceId case articleId } 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) serviceId = try container.decodeIfPresent(Int.self, forKey: .serviceId) articleId = try container.decodeIfPresent(Int.self, forKey: .articleId) } 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 serviceId != nil { try container.encode(serviceId, forKey: .serviceId) } if articleId != nil { try container.encode(articleId, forKey: .articleId) } } } public class BaseModel : Codable { required public init(){} }