/* Options: Date: 2025-05-10 04:13:26 SwiftVersion: 5.0 Version: 8.40 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://active-ewebservice.biz/aeservices30/api //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: History360Request.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack /** * History360Requires active-e Customer Service. */ // @Route("/History360", "GET") // @DataContract public class History360Request : BaseSecureRequest, IReturn { public typealias Return = History360Response // @DataMember public var customerAccount:Int // @DataMember public var includeInvoices:Bool // @DataMember public var includeOrders:Bool // @DataMember public var includeWorkOrders:Bool // @DataMember public var includeContracts:Bool // @DataMember public var includeClosed:Bool // @DataMember public var closedStartDate:Date? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case customerAccount case includeInvoices case includeOrders case includeWorkOrders case includeContracts case includeClosed case closedStartDate } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) customerAccount = try container.decodeIfPresent(Int.self, forKey: .customerAccount) includeInvoices = try container.decodeIfPresent(Bool.self, forKey: .includeInvoices) includeOrders = try container.decodeIfPresent(Bool.self, forKey: .includeOrders) includeWorkOrders = try container.decodeIfPresent(Bool.self, forKey: .includeWorkOrders) includeContracts = try container.decodeIfPresent(Bool.self, forKey: .includeContracts) includeClosed = try container.decodeIfPresent(Bool.self, forKey: .includeClosed) closedStartDate = try container.decodeIfPresent(Date.self, forKey: .closedStartDate) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if customerAccount != nil { try container.encode(customerAccount, forKey: .customerAccount) } if includeInvoices != nil { try container.encode(includeInvoices, forKey: .includeInvoices) } if includeOrders != nil { try container.encode(includeOrders, forKey: .includeOrders) } if includeWorkOrders != nil { try container.encode(includeWorkOrders, forKey: .includeWorkOrders) } if includeContracts != nil { try container.encode(includeContracts, forKey: .includeContracts) } if includeClosed != nil { try container.encode(includeClosed, forKey: .includeClosed) } if closedStartDate != nil { try container.encode(closedStartDate, forKey: .closedStartDate) } } } // @DataContract public class History360Response : BaseResponse { // @DataMember public var invoices:[Invoice360] = [] // @DataMember public var orders:[Order360] = [] // @DataMember public var workOrders:[WorkOrder360] = [] // @DataMember public var contracts:[Contract360] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case invoices case orders case workOrders case contracts } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) invoices = try container.decodeIfPresent([Invoice360].self, forKey: .invoices) ?? [] orders = try container.decodeIfPresent([Order360].self, forKey: .orders) ?? [] workOrders = try container.decodeIfPresent([WorkOrder360].self, forKey: .workOrders) ?? [] contracts = try container.decodeIfPresent([Contract360].self, forKey: .contracts) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if invoices.count > 0 { try container.encode(invoices, forKey: .invoices) } if orders.count > 0 { try container.encode(orders, forKey: .orders) } if workOrders.count > 0 { try container.encode(workOrders, forKey: .workOrders) } if contracts.count > 0 { try container.encode(contracts, forKey: .contracts) } } } // @DataContract public class BaseRequest : Codable { /** * This is your AIM API Key provided by Tri-Tech */ // @DataMember // @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header") public var apiKey:String // @DataMember // @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header") public var oAuthToken:String required public init(){} } // @DataContract public class BaseSecureRequest : BaseRequest { /** * */ // @DataMember // @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header") public var token:String /** * */ // @DataMember // @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header") public var deviceId:String /** * */ // @DataMember // @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header") public var appId:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case token case deviceId case appId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) token = try container.decodeIfPresent(String.self, forKey: .token) deviceId = try container.decodeIfPresent(String.self, forKey: .deviceId) appId = try container.decodeIfPresent(String.self, forKey: .appId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if token != nil { try container.encode(token, forKey: .token) } if deviceId != nil { try container.encode(deviceId, forKey: .deviceId) } if appId != nil { try container.encode(appId, forKey: .appId) } } } // @DataContract public class Invoice360 : Codable { // @DataMember public var id:String // @DataMember public var dueDate:Date? // @DataMember public var total:Double // @DataMember public var status:String // @DataMember public var amountPaid:Double // @DataMember public var lateFeeAmount:Double // @DataMember public var purchaseDate:Date // @DataMember public var storeLocationId:Int? // @DataMember public var items:[Item360] = [] required public init(){} } // @DataContract public class Order360 : Codable { // @DataMember public var id:Int // @DataMember public var date:Date // @DataMember public var discount:Double // @DataMember public var paymentType:String // @DataMember public var subTotal:Double // @DataMember public var tax:Double // @DataMember public var shippingAmount:Double // @DataMember public var total:Double required public init(){} } // @DataContract public class WorkOrder360 : Codable { // @DataMember public var id:String // @DataMember public var status:String // @DataMember public var deposit:Double // @DataMember public var storeLocationId:Int? // @DataMember public var creationDate:Date // @DataMember public var completedDate:Date? // @DataMember public var price:Double // @DataMember public var jobs:[Job360] = [] required public init(){} } // @DataContract public class Contract360 : Codable { // @DataMember public var id:String // @DataMember public var paymentDate:Date // @DataMember public var storeLocationId:Int? // @DataMember public var amountDue:Double // @DataMember public var lateFee:Double // @DataMember public var contractStatus:String // @DataMember public var amount:Double // @DataMember public var contractItems:[Item360] = [] required public init(){} } // @DataContract public class Item360 : Codable { // @DataMember public var pslrId:Int? // @DataMember public var quantity:Double // @DataMember public var price:Double // @DataMember public var totalDiscountAmount:Double // @DataMember public var serialNumber:String // @DataMember public var condition:String required public init(){} } // @DataContract public class Job360 : Codable { // @DataMember public var itemId:String // @DataMember public var itemType:String // @DataMember public var title:String // @DataMember public var quantity:Double // @DataMember public var price:Double // @DataMember public var totalDiscountAmount:Double // @DataMember public var serialNumber:String // @DataMember public var condition:String required public init(){} } // @DataContract public class BaseResponse : Codable { /** * */ // @DataMember // @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body") public var status:BaseResponseResult required public init(){} }