| All Verbs | /{Brand}/showscansettings/{TemplateGuid} |
|---|
import Foundation
import ServiceStack
public class ShowScanSettings : RequestBase
{
public var templateGuid:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case templateGuid
}
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)
}
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) }
}
}
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
}
public class GetScanSettingsResponse : GetTemplateResponse
{
//scanSettings:IScanSettings ignored. Swift doesn't support interface properties
public var colourLabel:String
public var orientationLabel:String
public var resolutionLabel:String
public var sidesLabel:String
public var sizeLabel:String
public var sourceLabel:String
public var typeLabel:String
public var scanContinuouslyLabel:String
public var mixedSizesLabel:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case scanSettings
case colourLabel
case orientationLabel
case resolutionLabel
case sidesLabel
case sizeLabel
case sourceLabel
case typeLabel
case scanContinuouslyLabel
case mixedSizesLabel
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
scanSettings = try container.decodeIfPresent(IScanSettings.self, forKey: .scanSettings)
colourLabel = try container.decodeIfPresent(String.self, forKey: .colourLabel)
orientationLabel = try container.decodeIfPresent(String.self, forKey: .orientationLabel)
resolutionLabel = try container.decodeIfPresent(String.self, forKey: .resolutionLabel)
sidesLabel = try container.decodeIfPresent(String.self, forKey: .sidesLabel)
sizeLabel = try container.decodeIfPresent(String.self, forKey: .sizeLabel)
sourceLabel = try container.decodeIfPresent(String.self, forKey: .sourceLabel)
typeLabel = try container.decodeIfPresent(String.self, forKey: .typeLabel)
scanContinuouslyLabel = try container.decodeIfPresent(String.self, forKey: .scanContinuouslyLabel)
mixedSizesLabel = try container.decodeIfPresent(String.self, forKey: .mixedSizesLabel)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if scanSettings != nil { try container.encode(scanSettings, forKey: .scanSettings) }
if colourLabel != nil { try container.encode(colourLabel, forKey: .colourLabel) }
if orientationLabel != nil { try container.encode(orientationLabel, forKey: .orientationLabel) }
if resolutionLabel != nil { try container.encode(resolutionLabel, forKey: .resolutionLabel) }
if sidesLabel != nil { try container.encode(sidesLabel, forKey: .sidesLabel) }
if sizeLabel != nil { try container.encode(sizeLabel, forKey: .sizeLabel) }
if sourceLabel != nil { try container.encode(sourceLabel, forKey: .sourceLabel) }
if typeLabel != nil { try container.encode(typeLabel, forKey: .typeLabel) }
if scanContinuouslyLabel != nil { try container.encode(scanContinuouslyLabel, forKey: .scanContinuouslyLabel) }
if mixedSizesLabel != nil { try container.encode(mixedSizesLabel, forKey: .mixedSizesLabel) }
}
}
public class GetTemplateResponse : ScanResponseBase
{
public var serverAddress:String
public var serverPort:Int
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case serverAddress
case serverPort
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
serverAddress = try container.decodeIfPresent(String.self, forKey: .serverAddress)
serverPort = try container.decodeIfPresent(Int.self, forKey: .serverPort)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if serverAddress != nil { try container.encode(serverAddress, forKey: .serverAddress) }
if serverPort != nil { try container.encode(serverPort, forKey: .serverPort) }
}
}
public class ScanResponseBase : ResponseBase
{
//template:IClientTemplate ignored. Swift doesn't support interface properties
public var globalQuestions:[IClientQuestion] = []
public var canEnableScanButton:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case template
case globalQuestions
case canEnableScanButton
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
template = try container.decodeIfPresent(IClientTemplate.self, forKey: .template)
globalQuestions = try container.decodeIfPresent([IClientQuestion].self, forKey: .globalQuestions) ?? []
canEnableScanButton = try container.decodeIfPresent(Bool.self, forKey: .canEnableScanButton)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if template != nil { try container.encode(template, forKey: .template) }
if globalQuestions.count > 0 { try container.encode(globalQuestions, forKey: .globalQuestions) }
if canEnableScanButton != nil { try container.encode(canEnableScanButton, forKey: .canEnableScanButton) }
}
}
public class ResponseBase : DtoBase
{
public var selectedUiLanguage:String
public var svSession:String
public var title:String
public var pageTip:String
public var newBrowser:Bool
public var scanFront400TA:Bool
public var scanFront400UTAX:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case selectedUiLanguage
case svSession
case title
case pageTip
case newBrowser
case scanFront400TA
case scanFront400UTAX
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
selectedUiLanguage = try container.decodeIfPresent(String.self, forKey: .selectedUiLanguage)
svSession = try container.decodeIfPresent(String.self, forKey: .svSession)
title = try container.decodeIfPresent(String.self, forKey: .title)
pageTip = try container.decodeIfPresent(String.self, forKey: .pageTip)
newBrowser = try container.decodeIfPresent(Bool.self, forKey: .newBrowser)
scanFront400TA = try container.decodeIfPresent(Bool.self, forKey: .scanFront400TA)
scanFront400UTAX = try container.decodeIfPresent(Bool.self, forKey: .scanFront400UTAX)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if selectedUiLanguage != nil { try container.encode(selectedUiLanguage, forKey: .selectedUiLanguage) }
if svSession != nil { try container.encode(svSession, forKey: .svSession) }
if title != nil { try container.encode(title, forKey: .title) }
if pageTip != nil { try container.encode(pageTip, forKey: .pageTip) }
if newBrowser != nil { try container.encode(newBrowser, forKey: .newBrowser) }
if scanFront400TA != nil { try container.encode(scanFront400TA, forKey: .scanFront400TA) }
if scanFront400UTAX != nil { try container.encode(scanFront400UTAX, forKey: .scanFront400UTAX) }
}
}
public protocol IClientTemplate
{
var Description:String { get set }
var icon:[UInt8] { get set }
//modificationInfo:ITemplateModificationInfo ignored. Swift doesn't support interface properties
var name:String { get set }
var questions:[IClientQuestion] { get set }
//template:ITemplate ignored. Swift doesn't support interface properties
var templateGuid:String { get set }
}
public protocol ITemplateModificationInfo
{
var guid:String { get set }
var templateModificationDateTime:Date { get set }
var iconModificationDateTime:Date { get set }
}
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 }
}
public protocol ITemplate : IStatus
{
var templateVersion:String { get set }
var scannerVisionVersion:String { get set }
var guid:String { get set }
var beginScript:String { get set }
var endScript:String { get set }
var templateType:TemplateType { get set }
//general:IGeneral ignored. Swift doesn't support interface properties
//capture:ICapture ignored. Swift doesn't support interface properties
//xmlMetadataImport:IXmlMetadataImport ignored. Swift doesn't support interface properties
//notifications:INotifications ignored. Swift doesn't support interface properties
//validator:IValidator ignored. Swift doesn't support interface properties
}
public enum TemplateType : String, Codable
{
case Workflow
case FreeForm
}
public protocol IGeneral : IInterface
{
var name:String { get set }
var Description:String { get set }
var icon:String { get set }
//schedule:ITemplateSchedule ignored. Swift doesn't support interface properties
//rejection:IRejection ignored. Swift doesn't support interface properties
//badDocumentRejection:IBadDocumentRejection ignored. Swift doesn't support interface properties
var pdfLoadResolution:PdfLoadResolution? { get set }
}
public protocol ITemplateSchedule : IInterface
{
var time:TimeInterval? { get set }
var endTime:TimeInterval? { get set }
var noEndTime:Bool? { get set }
var type:TemplateScheduleType? { get set }
}
public enum TemplateScheduleType : String, Codable
{
case Interval
case Fixed
}
public protocol IRejection
{
var rejectAfter:Int? { get set }
var rejectionPath:String { get set }
//shareCredentials:ICredentials ignored. Swift doesn't support interface properties
}
public protocol ICredentials : IInterface
{
var username:String { get set }
var password:String { get set }
}
public protocol IBadDocumentRejection : IStatus
{
var rejectionPath:String { get set }
//shareCredentials:ICredentials ignored. Swift doesn't support interface properties
}
public enum PdfLoadResolution : String, Codable
{
case Default
case Dpi100
case Dpi150
case Dpi200
case Dpi300
case Dpi400
case Dpi500
case Dpi600
}
public protocol ICapture : IInterface
{
var captureSources:ReadOnlyCollection<ICaptureSource> { get set }
}
public protocol ICaptureSource : IStatus
{
}
public protocol IXmlMetadataImport : IStatus
{
var sampleDocumentName:String { get set }
var tagMappings:ReadOnlyCollection<IXmlMetadataImportTagMapping> { get set }
var namespaceMappings:ReadOnlyCollection<IXmlMetadataImportNamespaceMapping> { get set }
}
public protocol IXmlMetadataImportTagMapping : IInterface
{
var xPathExpression:String { get set }
//metadata:IStringMetadata ignored. Swift doesn't support interface properties
}
public protocol IStringMetadata : IMetadata
{
var isSecure:Bool? { get set }
var sampleValue:String { get set }
var value:String { get set }
}
public protocol IXmlMetadataImportNamespaceMapping : IInterface
{
var `prefix`:String { get set }
var name:String { get set }
}
public protocol INotifications : IStatus
{
var notifications:ReadOnlyCollection<INotification> { get set }
}
public protocol INotification : IStatus
{
var Description:String { get set }
var to:String { get set }
var subject:String { get set }
var body:String { get set }
var cc:String { get set }
var bcc:String { get set }
var notificationType:NotificationType? { get set }
}
public enum NotificationType : String, Codable
{
case FailureOnly
case SuccessOnly
case Always
}
public protocol IValidator
{
//validationErrors:IValidationErrors ignored. Swift doesn't support interface properties
var isValid:Bool { get set }
}
public protocol IValidationErrors
{
var errors:ReadOnlyCollection<IValidationError> { get set }
}
public protocol IValidationError
{
var property:String { get set }
var errorMessage:String { get set }
}
public protocol IScanSettings
{
//colour:IScanSetting<ScanColour> ignored. Swift doesn't support interface properties
//orientation:IScanSetting<ScanOrientation> ignored. Swift doesn't support interface properties
//resolution:IScanSetting<ScanResolution> ignored. Swift doesn't support interface properties
//sides:IScanSetting<ScanSide> ignored. Swift doesn't support interface properties
//size:IScanSetting<ScanSize> ignored. Swift doesn't support interface properties
//source:IScanSetting<ScanSource> ignored. Swift doesn't support interface properties
//type:IScanSetting<ScanType> ignored. Swift doesn't support interface properties
//scanContinuously:IScanSetting<BoolSetting> ignored. Swift doesn't support interface properties
//mixedSizes:IScanSetting<BoolSetting> ignored. Swift doesn't support interface properties
}
public protocol IScanSetting
{
associatedtype T
var isLocked:Bool { get set }
var items:IList<IScanSettingItem<T>> { get set }
var selectedItem:String { get set }
}
public enum ScanColour : String, Codable
{
case BlackAndWhite
case Greyscale
case Colour
case Auto
}
public enum ScanOrientation : String, Codable
{
case Portrait
case Landscape
}
public enum ScanResolution : String, Codable
{
case Dpi100
case Dpi200
case Dpi300
case Dpi400
case Dpi600
}
public enum ScanSide : String, Codable
{
case Simplex
case Duplex
}
public enum ScanSize : String, Codable
{
case Auto
case A3
case A4
case A5
case B4
case B5
case Letter
case Legal
case Executive
case Folio
case AutoLong
case A4R
case A5R
case A6R
case B6R
}
public enum ScanSource : String, Codable
{
case Adf
case Glass
case Auto
}
public enum ScanType : String, Codable
{
case Text
case Photo
case TextAndPhoto
}
public enum BoolSetting : String, Codable
{
case True
case False
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /{Brand}/showscansettings/{TemplateGuid} HTTP/1.1
Host: buildmax.org
Accept: application/json
Content-Type: application/json
Content-Length: length
{"TemplateGuid":"String","Brand":"Desktop"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"ColourLabel":"Colors","OrientationLabel":"Orientation","ResolutionLabel":"Resolution","SidesLabel":"Sides","SizeLabel":"Size","SourceLabel":"Source","TypeLabel":"Type","ScanContinuouslyLabel":"Scan continuously","MixedSizesLabel":"Mix size","ServerAddress":"String","ServerPort":0,"CanEnableScanButton":true,"SelectedUiLanguage":"String","svSession":"String","Title":"String","PageTip":"String","NewBrowser":false,"ScanFront400TA":false,"ScanFront400UTAX":false,"Brand":"Desktop"}