Requires any of the roles: | bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read |
GET | /newsletter/log | Search the newsletter log for any messages | Search the newsletter log for any messages. |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
public class NewsletterLogQuery : QueryDb2<NewsletterLog, NewsletterLogQueryResponse>, 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 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 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)
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 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 NewsletterLog : BaseModel, IMessageLog
{
public var newslettersId:Int?
// @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 sendMethodId:Int?
// @Required()
public var receiver:String?
// @Required()
public var sender:String?
public var messageTitle:String
// @Required()
public var messageBody:String?
// @Required()
public var sent:Bool?
// @Required()
public var toSendDate:Date?
public var sentDate:Date?
public var messageCount:Int?
public var smsStatus:Int?
// @Required()
public var messageRetries:Int?
public var createdBy:String
// @Required()
public var created:Date?
public var storageUrl:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case newslettersId
case senderName
case modifiedDate
case correlationId
case companyId
case id
case sendMethodId
case receiver
case sender
case messageTitle
case messageBody
case sent
case toSendDate
case sentDate
case messageCount
case smsStatus
case messageRetries
case createdBy
case created
case storageUrl
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
newslettersId = try container.decodeIfPresent(Int.self, forKey: .newslettersId)
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)
sendMethodId = try container.decodeIfPresent(Int.self, forKey: .sendMethodId)
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)
sent = try container.decodeIfPresent(Bool.self, forKey: .sent)
toSendDate = try container.decodeIfPresent(Date.self, forKey: .toSendDate)
sentDate = try container.decodeIfPresent(Date.self, forKey: .sentDate)
messageCount = try container.decodeIfPresent(Int.self, forKey: .messageCount)
smsStatus = try container.decodeIfPresent(Int.self, forKey: .smsStatus)
messageRetries = try container.decodeIfPresent(Int.self, forKey: .messageRetries)
createdBy = try container.decodeIfPresent(String.self, forKey: .createdBy)
created = try container.decodeIfPresent(Date.self, forKey: .created)
storageUrl = try container.decodeIfPresent(String.self, forKey: .storageUrl)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if newslettersId != nil { try container.encode(newslettersId, forKey: .newslettersId) }
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 sendMethodId != nil { try container.encode(sendMethodId, forKey: .sendMethodId) }
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 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 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 createdBy != nil { try container.encode(createdBy, forKey: .createdBy) }
if created != nil { try container.encode(created, forKey: .created) }
if storageUrl != nil { try container.encode(storageUrl, forKey: .storageUrl) }
}
}
public class BaseModel : Codable
{
required public init(){}
}
public class NewsletterLogQueryResponse : Codable
{
/**
* The message log id
*/
// @ApiMember(Description="The message log id")
public var id: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
/**
* Nessage Title.
*/
// @ApiMember(Description="Nessage Title.")
public var messageTitle:String
/**
* Nessage Body.
*/
// @ApiMember(Description="Nessage 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 .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /newsletter/log HTTP/1.1 Host: testapi.bokamera.se Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Offset":0,"Total":0,"Results":[{"Id":0,"Receiver":"String","MessageTitle":"String","MessageBody":"String","SentDate":"0001-01-01T00:00:00","Sent":false,"MessageRetries":0,"SendMethodId":0}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}