| All Verbs | /alerts/getbyuser |
|---|
import Foundation
import ServiceStack
public class GetAlertsByUserRQ : Codable
{
public var user:String?
public var status:Int?
required public init(){}
}
public class GetAlertsByUserRS : CoreRS
{
public var data:[SystemAlert] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case data
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
data = try container.decodeIfPresent([SystemAlert].self, forKey: .data) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if data.count > 0 { try container.encode(data, forKey: .data) }
}
}
public class CoreRS : Codable
{
public var code:String?
public var errorMessage:String?
public var errorStackTrace:String?
required public init(){}
}
public class SystemAlert : Codable
{
public var generationType:Int?
public var generationTypeDesc:String?
public var alertOrigin:Int?
public var alertOriginDesc:String?
public var message:String?
public var longitude:Double?
public var latitude:Double?
public var modifiedUser:String?
public var modifiedDate:Date?
public var modifiedDateDesc:String?
public var notes:String?
public var fullinfo:String?
public var status:Int?
public var statusDesc:String?
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /alerts/getbyuser HTTP/1.1
Host: ws.jimsnwa.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
User: String,
Status: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Data:
[
{
GenerationType: 0,
GenerationTypeDesc: String,
AlertOrigin: 0,
AlertOriginDesc: String,
Message: String,
Longitude: 0,
Latitude: 0,
ModifiedUser: String,
ModifiedDate: 0001-01-01,
ModifiedDateDesc: String,
Notes: String,
Fullinfo: String,
Status: 0,
StatusDesc: String
}
],
Code: String,
ErrorMessage: String,
ErrorStackTrace: String
}