/* Options: Date: 2024-11-21 13:24:10 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: NewsletterLogQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/newsletter/log", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class NewsletterLogQuery : 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.", ParameterType="path") public var companyId:String? /** * If you want to search on sent messages */ // @ApiMember(DataType="boolean", Description="If you want to search on sent messages", ParameterType="query") public var sent:Bool? /** * Message Id */ // @ApiMember(DataType="int", Description="Message Id", ParameterType="query") public var id:Int? /** * If you want to search on a messages for a specific receiver */ // @ApiMember(DataType="string", Description="If you want to search on a messages for a specific receiver", ParameterType="query") public var receiver:String /** * If you want to search on a messages created a specific date */ // @ApiMember(DataType="datetime", Description="If you want to search on a messages created a specific date", ParameterType="query") public var created:Date? /** * If you want to search on a messages sent a specific date */ // @ApiMember(DataType="datetime", Description="If you want to search on a messages sent a specific date", ParameterType="query") public var sentDate:Date? public var responseStatus:ResponseStatus required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case sent case id case receiver case created case sentDate case responseStatus } 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) sent = try container.decodeIfPresent(Bool.self, forKey: .sent) id = try container.decodeIfPresent(Int.self, forKey: .id) receiver = try container.decodeIfPresent(String.self, forKey: .receiver) created = try container.decodeIfPresent(Date.self, forKey: .created) sentDate = try container.decodeIfPresent(Date.self, forKey: .sentDate) responseStatus = try container.decodeIfPresent(ResponseStatus.self, forKey: .responseStatus) } 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 sent != nil { try container.encode(sent, forKey: .sent) } if id != nil { try container.encode(id, forKey: .id) } if receiver != nil { try container.encode(receiver, forKey: .receiver) } if created != nil { try container.encode(created, forKey: .created) } if sentDate != nil { try container.encode(sentDate, forKey: .sentDate) } if responseStatus != nil { try container.encode(responseStatus, forKey: .responseStatus) } } } public protocol ICompany { var companyId:String? { get set } } public class NewsletterLog : BaseModel, IMessageLog { public var newslettersId:Int? // @Required() public var senderName:String? public var modifiedDate:Date? public var correlationId:String? // @Required() public var companyId:String? public var id:Int // @Required() public var sendMethodId:Int? // @Required() public var receiver:String? // @Required() public var sender:String? public var messageTitle:String // @Required() public var messageBody:String? // @Required() public var sent:Bool? // @Required() public var toSendDate:Date? public var sentDate:Date? public var messageCount:Int? public var smsStatus:Int? // @Required() public var messageRetries:Int? public var createdBy:String // @Required() public var created:Date? public var storageUrl:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case newslettersId case senderName case modifiedDate case correlationId case companyId case id case sendMethodId case receiver case sender case messageTitle case messageBody case sent case toSendDate case sentDate case messageCount case smsStatus case messageRetries case createdBy case created case storageUrl } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) newslettersId = try container.decodeIfPresent(Int.self, forKey: .newslettersId) senderName = try container.decodeIfPresent(String.self, forKey: .senderName) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) correlationId = try container.decodeIfPresent(String.self, forKey: .correlationId) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) id = try container.decodeIfPresent(Int.self, forKey: .id) sendMethodId = try container.decodeIfPresent(Int.self, forKey: .sendMethodId) receiver = try container.decodeIfPresent(String.self, forKey: .receiver) sender = try container.decodeIfPresent(String.self, forKey: .sender) messageTitle = try container.decodeIfPresent(String.self, forKey: .messageTitle) messageBody = try container.decodeIfPresent(String.self, forKey: .messageBody) sent = try container.decodeIfPresent(Bool.self, forKey: .sent) toSendDate = try container.decodeIfPresent(Date.self, forKey: .toSendDate) sentDate = try container.decodeIfPresent(Date.self, forKey: .sentDate) messageCount = try container.decodeIfPresent(Int.self, forKey: .messageCount) smsStatus = try container.decodeIfPresent(Int.self, forKey: .smsStatus) messageRetries = try container.decodeIfPresent(Int.self, forKey: .messageRetries) createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy) created = try container.decodeIfPresent(Date.self, forKey: .created) storageUrl = try container.decodeIfPresent(String.self, forKey: .storageUrl) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if newslettersId != nil { try container.encode(newslettersId, forKey: .newslettersId) } if senderName != nil { try container.encode(senderName, forKey: .senderName) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if correlationId != nil { try container.encode(correlationId, forKey: .correlationId) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } if id != nil { try container.encode(id, forKey: .id) } if sendMethodId != nil { try container.encode(sendMethodId, forKey: .sendMethodId) } if receiver != nil { try container.encode(receiver, forKey: .receiver) } if sender != nil { try container.encode(sender, forKey: .sender) } if messageTitle != nil { try container.encode(messageTitle, forKey: .messageTitle) } if messageBody != nil { try container.encode(messageBody, forKey: .messageBody) } if sent != nil { try container.encode(sent, forKey: .sent) } if toSendDate != nil { try container.encode(toSendDate, forKey: .toSendDate) } if sentDate != nil { try container.encode(sentDate, forKey: .sentDate) } if messageCount != nil { try container.encode(messageCount, forKey: .messageCount) } if smsStatus != nil { try container.encode(smsStatus, forKey: .smsStatus) } if messageRetries != nil { try container.encode(messageRetries, forKey: .messageRetries) } if createdBy != nil { try container.encode(createdBy, forKey: .createdBy) } if created != nil { try container.encode(created, forKey: .created) } if storageUrl != nil { try container.encode(storageUrl, forKey: .storageUrl) } } } public class BaseModel : Codable { required public init(){} } public protocol IMessageLog { var companyId:String { get set } var id:Int { get set } var receiver:String { get set } var sender:String { get set } var messageTitle:String { get set } var messageBody:String { get set } var createdBy:String { get set } var created:Date { get set } var sent:Bool { get set } var toSendDate:Date { get set } var sentDate:Date? { get set } var sendMethodId:Int { get set } var messageCount:Int? { get set } var smsStatus:Int? { get set } var messageRetries:Int { get set } var storageUrl:String { get set } } public class NewsletterLogQueryResponse : Codable { /** * The message log id */ // @ApiMember(Description="The message log id") public var id:Int /** * The message receiver. Either a email or a mobile phone number. */ // @ApiMember(Description="The message receiver. Either a email or a mobile phone number.") public var receiver:String /** * Nessage Title. */ // @ApiMember(Description="Nessage Title.") public var messageTitle:String /** * Nessage Body. */ // @ApiMember(Description="Nessage Body.") public var messageBody:String /** * When message was created. */ // @ApiMember(Description="When message was created.") public var created:Date /** * When the message will be sent. */ // @ApiMember(Description="When the message will be sent.") public var toSendDate:Date /** * When the message was sent. */ // @ApiMember(Description="When the message was sent.") public var sentDate:Date? /** * If Message is sent */ // @ApiMember(Description="If Message is sent") public var sent:Bool /** * Number of retries to send the message */ // @ApiMember(Description="Number of retries to send the message") public var messageRetries:Int /** * Send Method. 1 = Email, 2 = SMS */ // @ApiMember(Description="Send Method. 1 = Email, 2 = SMS") public var sendMethodId:Int required public init(){} }