/* Options: Date: 2024-11-21 12:06:21 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: CreateEAccountingArticle.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/eaccounting/articles", "POST") public class CreateEAccountingArticle : BaseArticleDto, IReturn, ICompany { public typealias Return = EAccountingArticleQueryResponse public var serviceId:Int public var companyId:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case serviceId case companyId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) serviceId = try container.decodeIfPresent(Int.self, forKey: .serviceId) 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 serviceId != nil { try container.encode(serviceId, forKey: .serviceId) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } } } public class EAccountingArticleQueryResponse : BaseArticleDto { public var unitId:String public var codingId:String public var vatRate:String public var vatRatePercent:String public var currencySign:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case unitId case codingId case vatRate case vatRatePercent case currencySign } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) unitId = try container.decodeIfPresent(String.self, forKey: .unitId) codingId = try container.decodeIfPresent(String.self, forKey: .codingId) vatRate = try container.decodeIfPresent(String.self, forKey: .vatRate) vatRatePercent = try container.decodeIfPresent(String.self, forKey: .vatRatePercent) currencySign = try container.decodeIfPresent(String.self, forKey: .currencySign) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if unitId != nil { try container.encode(unitId, forKey: .unitId) } if codingId != nil { try container.encode(codingId, forKey: .codingId) } if vatRate != nil { try container.encode(vatRate, forKey: .vatRate) } if vatRatePercent != nil { try container.encode(vatRatePercent, forKey: .vatRatePercent) } if currencySign != nil { try container.encode(currencySign, forKey: .currencySign) } } } public protocol ICompany { var companyId:String? { get set } } public class BaseArticleDto : Codable { public var articleId:String public var articlePrice:Double public var articleName:String public var createdDate:Date required public init(){} }