/* Options: Date: 2024-11-21 12:56:13 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: CompanyCreditCardInformation.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/billing/company/creditcard", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class CompanyCreditCardInformation : QueryDb2, IReturn, ICompany { public typealias Return = QueryResponse /** * The company id, if empty will use the company id for the user you are logged in with. */ // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.") public var companyId:String? /** * If you want to include only active credit cards */ // @ApiMember(DataType="boolean", Description="If you want to include only active credit cards", ParameterType="query") public var active:Bool /** * If you want to include only valid credit cards (not expired and valid) */ // @ApiMember(DataType="boolean", Description="If you want to include only valid credit cards (not expired and valid)", ParameterType="query") public var isValid:Bool required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case active case isValid } 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) active = try container.decodeIfPresent(Bool.self, forKey: .active) isValid = try container.decodeIfPresent(Bool.self, forKey: .isValid) } 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 active != nil { try container.encode(active, forKey: .active) } if isValid != nil { try container.encode(isValid, forKey: .isValid) } } } public protocol ICompany { var companyId:String? { get set } } public class CreditCard : BaseModel { // @Ignore() public var isValid:Bool // @Required() public var companyId:String? public var id:Int // @Required() public var name:String? // @Required() public var active:Bool? // @Required() public var type:String? // @Required() public var expYear:String? // @Required() public var expMonth:String? // @Required() public var ticketId:String? public var updated:Date? public var created:Date? public var modifiedDate:Date? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case isValid case companyId case id case name case active case type case expYear case expMonth case ticketId case updated case created case modifiedDate } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) isValid = try container.decodeIfPresent(Bool.self, forKey: .isValid) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) id = try container.decodeIfPresent(Int.self, forKey: .id) name = try container.decodeIfPresent(String.self, forKey: .name) active = try container.decodeIfPresent(Bool.self, forKey: .active) type = try container.decodeIfPresent(String.self, forKey: .type) expYear = try container.decodeIfPresent(String.self, forKey: .expYear) expMonth = try container.decodeIfPresent(String.self, forKey: .expMonth) ticketId = try container.decodeIfPresent(String.self, forKey: .ticketId) updated = try container.decodeIfPresent(Date.self, forKey: .updated) created = try container.decodeIfPresent(Date.self, forKey: .created) 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 isValid != nil { try container.encode(isValid, forKey: .isValid) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } if id != nil { try container.encode(id, forKey: .id) } if name != nil { try container.encode(name, forKey: .name) } if active != nil { try container.encode(active, forKey: .active) } if type != nil { try container.encode(type, forKey: .type) } if expYear != nil { try container.encode(expYear, forKey: .expYear) } if expMonth != nil { try container.encode(expMonth, forKey: .expMonth) } if ticketId != nil { try container.encode(ticketId, forKey: .ticketId) } if updated != nil { try container.encode(updated, forKey: .updated) } if created != nil { try container.encode(created, forKey: .created) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } } } public class BaseModel : Codable { required public init(){} } public class CompanyCreditCardQueryResponse : Codable { /** * The credit card id */ // @ApiMember(Description="The credit card id") public var id:Int /** * The credit card name */ // @ApiMember(Description="The credit card name") public var name:String /** * If the credit card is active */ // @ApiMember(Description="If the credit card is active") public var active:Bool /** * If the credit card is valid (active and not expired) */ // @ApiMember(Description="If the credit card is valid (active and not expired)") public var isValid:Bool /** * The credit card type */ // @ApiMember(Description="The credit card type") public var type:String /** * The credit card expiration Year */ // @ApiMember(Description="The credit card expiration Year") public var expYear:String /** * The credit card expiration month */ // @ApiMember(Description="The credit card expiration month") public var expMonth:String /** * The credit card ticket name. This is secret information and won't be displayed */ // @ApiMember(Description="The credit card ticket name. This is secret information and won't be displayed") public var ticketId:String /** * The date when the credit card was saved. */ // @ApiMember(Description="The date when the credit card was saved.") public var created:Date? /** * The date when the credit card was updated. */ // @ApiMember(Description="The date when the credit card was updated.") public var updated:Date? required public init(){} }