SAPcpmsUsageUploader
public class SAPcpmsUsageUploader
This component is capable of collecting and uploading usage records to SAPcpms server (or custom endpoint).
-
Collection of possible errors that could occur during the upload.
See moreDeclaration
Swift
public enum UploadError : SAPError
-
Collects the usage records for the given target identifier, and uploads them in the SAPcpms format to the given endpoint. After the upload a new session should be started.
Declaration
Swift
public static func upload(to settings: SAPcpmsSettingsParameters, sapURLSession: SAPURLSession, target: String = Usage.defaultTargetID, unattributedData: UsageSnapshotting? = nil, completionHandler: @escaping (Error?) -> Void = SAPcpmsUsageUploader.defaultCompletionHandler)
Parameters
settings
parameters from which the endpoint is created, only the ‘backendURL’ and the ‘applicationID’ parameters are used from this parameter
sapURLSession
the urlsession instance which will be used to upload the records
target
the target
unattributedData
anonymous user data (optional input to send parked unattributed usage snapshot data)
completionHandler
a block which will be called at the end of the upload process
-
Collects the usage records for the given target identifier, and uploads them in the SAPcpms format to the given endpoint. After the upload a new session should be started.
Declaration
Swift
public static func upload(to uploadEndPoint: URL, sapURLSession: SAPURLSession, target: String = Usage.defaultTargetID, sapcpmsSettingsParameters: SAPcpmsSettingsParameters? = nil, unattributedData: UsageSnapshotting? = nil, completionHandler: @escaping (Error?) -> Void = SAPcpmsUsageUploader.defaultCompletionHandler)
Parameters
uploadEndPoint
the desired upload endpoint
sapURLSession
the urlsession instance which will be used to upload the records
target
the target
sapcpmsSettingsParameters
the optional settings used to obtain application information for uploaded records
unattributedData
anonymous user data (optional input to send parked unattributed usage snapshot data)
completionHandler
a block which will be called at the end of the upload process
-
The default completion handler for SAPcpmsUsageUploader. Logs the error with the root logger if there is any.
Declaration
Swift
public static func defaultCompletionHandler(_ error: Error?)
Parameters
error
error that will be logged