BokaMera.API.Host

<back to all web services

DashboardMessageQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read
The following routes are available for this service:
GET/messages/dashboardSearch 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 .other suffix or ?format=other

HTTP + OTHER

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: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Offset":0,"Total":0,"Results":[{"Id":0,"Title":"String","Body":"String","Important":false,"MessageTypeId":0,"SupportCaseId":0,"MessageType":{"Id":0,"Name":"String","Description":"String","ImageUrl":"String","ApplicationMessage":false,"Icon":"String","Color":"String"}}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}