/* Options: Date: 2024-11-21 12:01:29 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: MessageLogQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/messages/log", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class MessageLogQuery : 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 booking */ // @ApiMember(DataType="int", Description="If you want to search on a messages for a specific booking", ParameterType="query") public var bookingId: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 bookingId 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) bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId) 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 bookingId != nil { try container.encode(bookingId, forKey: .bookingId) } 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 MessageLog : BaseModel, IMessageLog { public var bookingId:Int? // @Required() public var publicMessage:Bool? // @Required() public var messageType:Int? // @Required() public var iCalAttachment:Bool? // @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 receiver:String? // @Required() public var sender:String? public var messageTitle:String // @Required() public var messageBody:String? public var createdBy:String // @Required() public var created:Date? // @Required() public var sent:Bool? // @Required() public var toSendDate:Date? public var sentDate:Date? // @Required() public var sendMethodId:Int? public var messageCount:Int? public var smsStatus:Int? // @Required() public var messageRetries:Int? public var storageUrl:String public var language:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case bookingId case publicMessage case messageType case iCalAttachment case senderName case modifiedDate case correlationId case companyId case id case receiver case sender case messageTitle case messageBody case createdBy case created case sent case toSendDate case sentDate case sendMethodId case messageCount case smsStatus case messageRetries case storageUrl case language } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) bookingId = try container.decodeIfPresent(Int.self, forKey: .bookingId) publicMessage = try container.decodeIfPresent(Bool.self, forKey: .publicMessage) messageType = try container.decodeIfPresent(Int.self, forKey: .messageType) iCalAttachment = try container.decodeIfPresent(Bool.self, forKey: .iCalAttachment) 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) 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) createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy) created = try container.decodeIfPresent(Date.self, forKey: .created) sent = try container.decodeIfPresent(Bool.self, forKey: .sent) toSendDate = try container.decodeIfPresent(Date.self, forKey: .toSendDate) sentDate = try container.decodeIfPresent(Date.self, forKey: .sentDate) sendMethodId = try container.decodeIfPresent(Int.self, forKey: .sendMethodId) messageCount = try container.decodeIfPresent(Int.self, forKey: .messageCount) smsStatus = try container.decodeIfPresent(Int.self, forKey: .smsStatus) messageRetries = try container.decodeIfPresent(Int.self, forKey: .messageRetries) storageUrl = try container.decodeIfPresent(String.self, forKey: .storageUrl) language = try container.decodeIfPresent(String.self, forKey: .language) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if bookingId != nil { try container.encode(bookingId, forKey: .bookingId) } if publicMessage != nil { try container.encode(publicMessage, forKey: .publicMessage) } if messageType != nil { try container.encode(messageType, forKey: .messageType) } if iCalAttachment != nil { try container.encode(iCalAttachment, forKey: .iCalAttachment) } 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 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 createdBy != nil { try container.encode(createdBy, forKey: .createdBy) } if created != nil { try container.encode(created, forKey: .created) } 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 sendMethodId != nil { try container.encode(sendMethodId, forKey: .sendMethodId) } 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 storageUrl != nil { try container.encode(storageUrl, forKey: .storageUrl) } if language != nil { try container.encode(language, forKey: .language) } } } 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 MessageLogQueryResponse : Codable { /** * The message log id */ // @ApiMember(Description="The message log id") public var id:Int /** * The booking id for the message (if connected to a booking). */ // @ApiMember(Description="The booking id for the message (if connected to a booking).") public var bookingId: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 /** * Message Title. */ // @ApiMember(Description="Message Title.") public var messageTitle:String /** * Message Storage Url. */ // @ApiMember(Description="Message Storage Url.") public var storageUrl:String /** * Message Body. */ // @ApiMember(Description="Message 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(){} }