APIManager
Objective-C
@interface APIManager
Swift
class APIManager
A utitlity class used to perform all the different calls to ScanTrust’s backend server.
-
Shared instance for the APIManager class, initialise the APIManager class with necessary constants
Declaration
Objective-C
+ (nullable APIManager *)sharedInstance;
Swift
class func sharedInstance() -> APIManager?
-
To send a scan query (for unsupported phones / no-auth codes)
Declaration
Objective-C
- (void)sendScanQueryWithBasicScanCandidate:(id)scanCandidate token:(nullable NSString *)token completion: (void (^_Nullable)(int *_Nonnull, NSError *_Nullable)) completionBlock;
Swift
func sendScanQuery(withBasicScanCandidate scanCandidate: Any!, token: String?) async throws -> UnsafeMutablePointer<Int32>
Parameters
scanCandidate
scan data for basic scan
token
request authentication token
completionBlock
A block object to be executed when the network request finishes successfully. This block has return values of STAuthResposne class and NSError (if any)
-
To send a scan query (for unsupported phones / no-auth codes)
Declaration
Objective-C
- (void)sendScanQueryWithBasicScanCandidate:(id)scanCandidate completion: (void (^_Nullable)(int *_Nonnull, NSError *_Nullable)) completionBlock;
Swift
func sendScanQuery(withBasicScanCandidate scanCandidate: Any!) async throws -> UnsafeMutablePointer<Int32>
Parameters
scanCandidate
scan data for basic scan
completionBlock
A block object to be executed when the network request finishes successfully. This block has return values of STAuthResposne class and NSError (if any)
-
To Authenticate a scan
Declaration
Objective-C
- (void)authenticateAuthenticationRequestData: (nonnull SerializableAuthenticationRequestData *)requestData withAuthToken:(nullable NSString *)token completion: (void (^_Nullable)(int *_Nonnull, NSError *_Nullable)) completionBlock;
Swift
func authenticateAuthenticationRequestData(_ requestData: SerializableAuthenticationRequestData, withAuthToken token: String?) async throws -> UnsafeMutablePointer<Int32>
Parameters
requestData
authentication data
token
request authentication token
completionBlock
A block object to be executed when the network request finishes successfully. This block has return values of STAuthResposne class and NSError (if any)
-
To rget authentication details for a given code ID
Declaration
Objective-C
- (void)requestAuthenticationDetailsForCode:(nonnull NSString *)codeId onHost:(nonnull NSString *)host codeSpace:(nonnull NSString *)codeSpace by:(nonnull id)requester;
Swift
func requestAuthenticationDetails(forCode codeId: String, onHost host: String, codeSpace: String, by requester: Any)
Parameters
codeId
id string for the code
host
host name for a code
codeSpace
a code space string
requester
an object which confirms to
CodeAuthenticationDetailsReceiverProtocol