Requires any of the roles: | bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read |
GET | /messages/log | Search the message log for any messages | Search the message log for any messages. |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class MessageLogQuery : QueryDb2<MessageLog, MessageLogQueryResponse>, 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 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 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 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(){}
}
public class AccessKeyTypeResponse : Codable
{
public var id:Int
public var keyType:String
public var Description:String
required public init(){}
}
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/log HTTP/1.1 Host: api.bokamera.se Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <QueryResponseOfMessageLogQueryResponseWg5EthtI 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:MessageLogQueryResponse> <d2p1:BookingId>0</d2p1:BookingId> <d2p1:Created>0001-01-01T00:00:00</d2p1:Created> <d2p1:Id>0</d2p1:Id> <d2p1:MessageBody>String</d2p1:MessageBody> <d2p1:MessageRetries>0</d2p1:MessageRetries> <d2p1:MessageTitle>String</d2p1:MessageTitle> <d2p1:Receiver>String</d2p1:Receiver> <d2p1:SendMethodId>0</d2p1:SendMethodId> <d2p1:Sent>false</d2p1:Sent> <d2p1:SentDate>0001-01-01T00:00:00</d2p1:SentDate> <d2p1:StorageUrl>String</d2p1:StorageUrl> <d2p1:ToSendDate>0001-01-01T00:00:00</d2p1:ToSendDate> </d2p1:MessageLogQueryResponse> </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> </QueryResponseOfMessageLogQueryResponseWg5EthtI>