import Foundation
import ServiceStack
public class GetJsonPicklistItems : JsonDto
{
public var templateGuid:String
public var guid:String
public var answers:[String:String]
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case templateGuid
case guid
case answers
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
templateGuid = try container.decodeIfPresent(String.self, forKey: .templateGuid)
guid = try container.decodeIfPresent(String.self, forKey: .guid)
answers = try container.decodeIfPresent([String:String].self, forKey: .answers) ?? [:]
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if templateGuid != nil { try container.encode(templateGuid, forKey: .templateGuid) }
if guid != nil { try container.encode(guid, forKey: .guid) }
if answers != nil { try container.encode(answers, forKey: .answers) }
}
}
public class JsonDto : Codable
{
required public init(){}
}
public class JsonPicklistItemsResponse : JsonDto
{
public var guid:String
public var items:[JsonPicklistItem]
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case guid
case items
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
guid = try container.decodeIfPresent(String.self, forKey: .guid)
items = try container.decodeIfPresent([JsonPicklistItem].self, forKey: .items) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if guid != nil { try container.encode(guid, forKey: .guid) }
if items != nil { try container.encode(items, forKey: .items) }
}
}
public class JsonPicklistItem : Codable
{
public var key:String
public var value:String
required public init(){}
}
Swift GetJsonPicklistItems DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsonl/reply/GetJsonPicklistItems HTTP/1.1
Host: dmsshow.kyocerasolutions.cz
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"TemplateGuid":"String","Guid":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"Guid":"String","Items":[{"Key":"String","Value":"String"}]}