/* Options: Date: 2024-11-21 11:33:06 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: DashboardMessageQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/messages/dashboard", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class DashboardMessageQuery : 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 filter on important messages only */ // @ApiMember(DataType="boolean", Description="If you want to filter on important messages only", ParameterType="query") public var important:Bool? /** * Filter on Message Type Id */ // @ApiMember(DataType="int", Description="Filter on Message Type Id", ParameterType="query") public var messageTypeId:Int? /** * If you want to include the message type information */ // @ApiMember(DataType="boolean", Description="If you want to include the message type information", ParameterType="query") public var includeMessageTypeInformation:Bool public var responseStatus:ResponseStatus required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case important case messageTypeId case includeMessageTypeInformation 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) important = try container.decodeIfPresent(Bool.self, forKey: .important) messageTypeId = try container.decodeIfPresent(Int.self, forKey: .messageTypeId) includeMessageTypeInformation = try container.decodeIfPresent(Bool.self, forKey: .includeMessageTypeInformation) 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 important != nil { try container.encode(important, forKey: .important) } if messageTypeId != nil { try container.encode(messageTypeId, forKey: .messageTypeId) } if includeMessageTypeInformation != nil { try container.encode(includeMessageTypeInformation, forKey: .includeMessageTypeInformation) } if responseStatus != nil { try container.encode(responseStatus, forKey: .responseStatus) } } } public protocol ICompany { var companyId:String? { get set } } public class DashboardMessage : BaseModel { // @References(typeof(DashboardMessageType)) public var messageTypeId:Int public var messageType:DashboardMessageType // @Required() public var companyId:String? public var id:Int // @Required() public var title:String? // @Required() public var body:String? // @Required() public var important:Bool? // @Required() public var visibleFrom:Date? // @Required() public var visibleTo:Date? // @Required() public var created:Date? public var supportCaseId:Int? public var modifiedDate:Date? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case messageTypeId case messageType case companyId case id case title case body case important case visibleFrom case visibleTo case created case supportCaseId case modifiedDate } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) messageTypeId = try container.decodeIfPresent(Int.self, forKey: .messageTypeId) messageType = try container.decodeIfPresent(DashboardMessageType.self, forKey: .messageType) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) id = try container.decodeIfPresent(Int.self, forKey: .id) title = try container.decodeIfPresent(String.self, forKey: .title) body = try container.decodeIfPresent(String.self, forKey: .body) important = try container.decodeIfPresent(Bool.self, forKey: .important) visibleFrom = try container.decodeIfPresent(Date.self, forKey: .visibleFrom) visibleTo = try container.decodeIfPresent(Date.self, forKey: .visibleTo) created = try container.decodeIfPresent(Date.self, forKey: .created) supportCaseId = try container.decodeIfPresent(Int.self, forKey: .supportCaseId) 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 messageTypeId != nil { try container.encode(messageTypeId, forKey: .messageTypeId) } if messageType != nil { try container.encode(messageType, forKey: .messageType) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } if id != nil { try container.encode(id, forKey: .id) } if title != nil { try container.encode(title, forKey: .title) } if body != nil { try container.encode(body, forKey: .body) } if important != nil { try container.encode(important, forKey: .important) } if visibleFrom != nil { try container.encode(visibleFrom, forKey: .visibleFrom) } if visibleTo != nil { try container.encode(visibleTo, forKey: .visibleTo) } if created != nil { try container.encode(created, forKey: .created) } if supportCaseId != nil { try container.encode(supportCaseId, forKey: .supportCaseId) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } } } public class DashboardMessageQueryResponse : Codable { /** * The message id */ // @ApiMember(Description="The message id") public var id:Int /** * The message title. */ // @ApiMember(Description="The message title.") public var title:String /** * The message body. */ // @ApiMember(Description="The message body.") public var body:String /** * If the message is important. */ // @ApiMember(Description="If the message is important.") public var important:Bool /** * If the message visible from date. */ // @ApiMember(Description="If the message visible from date.") public var visibleFrom:Date /** * If the message visible to date. */ // @ApiMember(Description="If the message visible to date.") public var visibleTo:Date /** * If the message created date. */ // @ApiMember(Description="If the message created date.") public var created:Date /** * If the message type id. */ // @ApiMember(Description="If the message type id.") public var messageTypeId:Int /** * If the message is connected to a support case. */ // @ApiMember(Description="If the message is connected to a support case.") public var supportCaseId:Int? /** * If the message type information. */ // @ApiMember(Description="If the message type information.") public var messageType:DasboardMessageTypeResponse required public init(){} } public class BaseModel : Codable { required public init(){} } public class DashboardMessageType : BaseModel { // @Required() public var name:String? // @Required() public var Description:String? // @Required() public var image:String? public var applicationMessage:Bool? // @Required() public var color:String? // @Required() public var icon:String? public var modifiedDate:Date? public var id:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case name case Description case image case applicationMessage case color case icon case modifiedDate case id } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) Description = try container.decodeIfPresent(String.self, forKey: .Description) image = try container.decodeIfPresent(String.self, forKey: .image) applicationMessage = try container.decodeIfPresent(Bool.self, forKey: .applicationMessage) color = try container.decodeIfPresent(String.self, forKey: .color) icon = try container.decodeIfPresent(String.self, forKey: .icon) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) id = try container.decodeIfPresent(Int.self, forKey: .id) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if name != nil { try container.encode(name, forKey: .name) } if Description != nil { try container.encode(Description, forKey: .Description) } if image != nil { try container.encode(image, forKey: .image) } if applicationMessage != nil { try container.encode(applicationMessage, forKey: .applicationMessage) } if color != nil { try container.encode(color, forKey: .color) } if icon != nil { try container.encode(icon, forKey: .icon) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if id != nil { try container.encode(id, forKey: .id) } } } public class DasboardMessageTypeResponse : Codable { /** * The message type id */ // @ApiMember(Description="The message type id") public var id:Int /** * The message type name */ // @ApiMember(Description="The message type name") public var name:String /** * The message type description */ // @ApiMember(Description="The message type description") public var Description:String /** * The message type image */ // @ApiMember(Description="The message type image") public var imageUrl:String /** * If the message type is a application message */ // @ApiMember(Description="If the message type is a application message") public var applicationMessage:Bool? /** * The message type icon */ // @ApiMember(Description="The message type icon") public var icon:String /** * The message type color */ // @ApiMember(Description="The message type color") public var color:String required public init(){} }