ScannerVision Web Server

<back to all web services

GetScanSBC

Requires Authentication
The following routes are available for this service:
POST/{Brand}/scan
import Foundation
import ServiceStack

public class GetScanSBC : RequestBase
{
    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 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 GetScanResponse : ResponseBase
{
    public var doGetImage:Bool
    public var templateGuid:String
    public var fileNameGuid:String
    public var serverUrlRoot:String
    public var templateIcon:[UInt8] = []
    public var templateName:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case doGetImage
        case templateGuid
        case fileNameGuid
        case serverUrlRoot
        case templateIcon
        case templateName
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        doGetImage = try container.decodeIfPresent(Bool.self, forKey: .doGetImage)
        templateGuid = try container.decodeIfPresent(String.self, forKey: .templateGuid)
        fileNameGuid = try container.decodeIfPresent(String.self, forKey: .fileNameGuid)
        serverUrlRoot = try container.decodeIfPresent(String.self, forKey: .serverUrlRoot)
        templateIcon = try container.decodeIfPresent([UInt8].self, forKey: .templateIcon) ?? []
        templateName = try container.decodeIfPresent(String.self, forKey: .templateName)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if doGetImage != nil { try container.encode(doGetImage, forKey: .doGetImage) }
        if templateGuid != nil { try container.encode(templateGuid, forKey: .templateGuid) }
        if fileNameGuid != nil { try container.encode(fileNameGuid, forKey: .fileNameGuid) }
        if serverUrlRoot != nil { try container.encode(serverUrlRoot, forKey: .serverUrlRoot) }
        if templateIcon.count > 0 { try container.encode(templateIcon, forKey: .templateIcon) }
        if templateName != nil { try container.encode(templateName, forKey: .templateName) }
    }
}

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) }
    }
}


Swift GetScanSBC DTOs

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

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /{Brand}/scan HTTP/1.1 
Host: buildmax.org 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Brand":"Desktop"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"DoGetImage":false,"TemplateGuid":"String","FileNameGuid":"String","ServerUrlRoot":"String","TemplateIcon":"AA==","TemplateName":"String","SelectedUiLanguage":"String","svSession":"String","Title":"String","PageTip":"String","NewBrowser":false,"ScanFront400TA":false,"ScanFront400UTAX":false,"Brand":"Desktop"}