| All Verbs | /{Brand}/templates/{TemplateGuid}/submit |
|---|
import Foundation
import ServiceStack
public class BrotherTemplateQuestionResponse : QuestionRequestDto
{
//question:IClientQuestion ignored. Swift doesn't support interface properties
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case question
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
question = try container.decodeIfPresent(IClientQuestion.self, forKey: .question)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if question != nil { try container.encode(question, forKey: .question) }
}
}
public class QuestionRequestDto : RequestBase
{
public var templateGuid:String
public var questionGuid:String
public var parent:String
public var folderBrowser:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case templateGuid
case questionGuid
case parent
case folderBrowser
}
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)
questionGuid = try container.decodeIfPresent(String.self, forKey: .questionGuid)
parent = try container.decodeIfPresent(String.self, forKey: .parent)
folderBrowser = try container.decodeIfPresent(String.self, forKey: .folderBrowser)
}
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 questionGuid != nil { try container.encode(questionGuid, forKey: .questionGuid) }
if parent != nil { try container.encode(parent, forKey: .parent) }
if folderBrowser != nil { try container.encode(folderBrowser, forKey: .folderBrowser) }
}
}
public class RequestBase : DtoBase
{
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 DtoBase : Codable
{
public var brand:Brand
required public init(){}
}
public enum Brand : String, Codable
{
case Desktop
case Hp
case Kyocera
case NeaScan
case Samsung
case FujiXerox
case Ta
case Utax
case Epson
case ScanFront400
case Sharp
case Ricoh
case FujiFilm
case Brother
}
public protocol IClientQuestion : ITemplateQuestion
{
var questionGuid:String { get set }
var valueDisplayed:String { get set }
var valueReturned:String { get set }
var answered:Bool { get set }
var regexMatches:Bool { get set }
var regexHint:String { get set }
}
Swift BrotherTemplateQuestionResponse DTOs
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.
POST /{Brand}/templates/{TemplateGuid}/submit HTTP/1.1
Host: dmsshow.kyocerasolutions.cz
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"TemplateGuid":"String","QuestionGuid":"String","Parent":"String","FolderBrowser":"String","Brand":"Desktop"}