SAPcpmsDestinations
open class SAPcpmsDestinations
Loads the configured destination name(s) and path(s) from SAP Mobile Services.
This sample code demonstrates how to create an SAPcpmsDestinations instance:
var urlSession = SAPURLSession()
let settingsParameters = SAPcpmsSettingsParameters(backendURL: <#URL only with domain#>, applicationID: <#appid#>)
let destinations = SAPcpmsDestinations(sapURLSession: urlSession, settingsParameters: settingsParameters)
-
Initializer for using SAPURLSession and the service url as an input
Declaration
Swift
public init(sapURLSession: SAPURLSession, destinationsServiceUrl: URL, remoteDestinationsEndpointUrl: URL? = nil)Parameters
sapURLSessionan SAPURLSession implementation that can be used to communicate with the SAP Mobile Services
endpointsServiceUrlthe full URL of the endpoints service
remoteDestinationsEndpointUrlthe full URL of the remote destinations endpoint service
-
Initializer for using SAPURLSession and SAPcpmsSettingsParameters as an input
Declaration
Swift
public convenience init(sapURLSession: SAPURLSession, settingsParameters: SAPcpmsSettingsParameters)Parameters
sapURLSessionan SAPURLSession implementation that can be used to communicate with the SAP Mobile Services
settingsParametersSAPcpms settings metadata to be able to concatenate the SAPcpms service URL; The ‘backendURL’ and the ‘applicationID’ are used from this parameter.
-
Loads the configured destination(s) from mobile services.
Declaration
Swift
open func load(completionHandler: @escaping ([String : String]?, Error?) -> Void)Parameters
completionHandlercalled when the result received from the server on background queue. In a successful case the error parameter is nil.
-
Loads the configured destination(s) from mobile services and adds to the settingsParameters.
Declaration
Swift
open func load(to settingsParameters: SAPcpmsSettingsParameters, completionHandler: @escaping (SAPcpmsSettingsParameters?, Error?) -> Void)Parameters
settingsParameterssettingsParameters which will be updated with the destinations
completionHandlercalled when the result received from the server. In a successful case the error parameter is nil.
-
Loads the configured remote destinations from SAP Mobile Services.
Declaration
Swift
open func loadRemoteDestinations(completionHandler: @escaping (Result<DestinationResultSet, Error>) -> Void)Parameters
completionHandlerA closure that is called when the load operation completes. The closure receives a
Resultcontaining either theDestinationResultSetobject on success or anErroron failure. -
Loads the configured remote destination(s) from mobile services and adds to the settingsParameters. Use settingsParameters.remoteDestinations to get the list of remote destinations
Sample Code:
let remoteDestinations = settingsParameters.remoteDestinations let remoteURL = remoteDestinations["<#REMOTE_DESTINATION_ENDPOINT_NAME#>"].remoteURLDeclaration
Swift
public func loadRemoteDestinations(to settingsParameters: SAPcpmsSettingsParameters, completionHandler: @escaping (Result<SAPcpmsSettingsParameters, Error>) -> Void)Parameters
settingsParameterssettingsParameters which will be updated with the remote destinations
completionHandlercalled when the result received from the server. The closure receives a
Resultcontaining either theSAPcpmsSettingsParametersobject on success or anErroron failure.