Skip to main content

APIManager

Scantrust iOS SDK provides APIManager to perform network requests to Scantrust's backend server. It is a singleton class which is using URLSession for network requests.

Basic Usage

let data = SerializableAuthenticationRequestData.init(authenticationScanCandidate: candidate, comesFromUnreadableFlow: false)
APIManager.sharedInstance()?.authenticateAuthenticationRequestData(data, withAuthToken: nil, completion: { [weak self] response, error in
// handle error and response
}

APIManager has two kind of requests to contact the backend.

  • authenticateAuthenticationRequestData - to authenticate secure code with backend
  • sendScanQueryWithParsedContent - to send a scan query with backend. Mainly used for unsupported phones and non auth codes

Model Objects

To make it easy to create and consume data with Scantrust backend, SDK provides varies model objects. Each has it's own responsibilities.

  • SerializableAuthenticationRequestData: to create authentication request for APIManager
  • BasicScanCandidate: to create scan query request for APIManager
  • STAuthResponse: response object for authenticate and scan query
  • STBrand: class to represents the brand details and to represent the details about brand which was associated to the scanned QR code
  • STProduct: class which represents the product details and to represent the details about product which was associated to the scanned QR code