Requires any of the roles: | bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read |
GET | /messages/dashboard | Search the dashboard messages for any messages. | Search the dashboard messages for any messages. |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class DashboardMessageQuery : QueryDb2<DashboardMessage, DashboardMessageQueryResponse>, ICompany
{
/**
* 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 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 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 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 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(){}
}
public class AccessKeyTypeResponse : Codable
{
public var id:Int
public var keyType:String
public var Description:String
required public init(){}
}
Swift DashboardMessageQuery DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /messages/dashboard HTTP/1.1 Host: api.bokamera.se Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <QueryResponseOfDashboardMessageQueryResponseWg5EthtI xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <Offset>0</Offset> <Total>0</Total> <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <d2p1:DashboardMessageQueryResponse> <d2p1:Body>String</d2p1:Body> <d2p1:Created>0001-01-01T00:00:00</d2p1:Created> <d2p1:Id>0</d2p1:Id> <d2p1:Important>false</d2p1:Important> <d2p1:MessageType> <d2p1:ApplicationMessage>false</d2p1:ApplicationMessage> <d2p1:Color>String</d2p1:Color> <d2p1:Description>String</d2p1:Description> <d2p1:Icon>String</d2p1:Icon> <d2p1:Id>0</d2p1:Id> <d2p1:ImageUrl>String</d2p1:ImageUrl> <d2p1:Name>String</d2p1:Name> </d2p1:MessageType> <d2p1:MessageTypeId>0</d2p1:MessageTypeId> <d2p1:SupportCaseId>0</d2p1:SupportCaseId> <d2p1:Title>String</d2p1:Title> <d2p1:VisibleFrom>0001-01-01T00:00:00</d2p1:VisibleFrom> <d2p1:VisibleTo>0001-01-01T00:00:00</d2p1:VisibleTo> </d2p1:DashboardMessageQueryResponse> </Results> <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:KeyValueOfstringstring> <d2p1:Key>String</d2p1:Key> <d2p1:Value>String</d2p1:Value> </d2p1:KeyValueOfstringstring> </Meta> <ResponseStatus> <ErrorCode>String</ErrorCode> <Message>String</Message> <StackTrace>String</StackTrace> <Errors> <ResponseError> <ErrorCode>String</ErrorCode> <FieldName>String</FieldName> <Message>String</Message> <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </Meta> </ResponseError> </Errors> <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </Meta> </ResponseStatus> </QueryResponseOfDashboardMessageQueryResponseWg5EthtI>