GET | /accesskeytypes | Get all AccessKeyTypes | Get all AccessKeyTypes |
---|
import Foundation
import ServiceStack
public class AccessKeyTypeQuery : QueryDb2<AccessKeyType, AccessKeyTypeResponse>
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class AccessKeyType : BaseModel
{
// @Required()
public var keyType:String?
public var Description:String
public var id:Int
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case keyType
case Description
case id
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
keyType = try container.decodeIfPresent(String.self, forKey: .keyType)
Description = try container.decodeIfPresent(String.self, forKey: .Description)
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 keyType != nil { try container.encode(keyType, forKey: .keyType) }
if Description != nil { try container.encode(Description, forKey: .Description) }
if id != nil { try container.encode(id, forKey: .id) }
}
}
public class BaseModel : Codable
{
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 /accesskeytypes HTTP/1.1 Host: api.bokamera.se Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Offset":0,"Total":0,"Results":[{"Id":0,"KeyType":"String","Description":"String"}],"Meta":{"String":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}