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

    sapURLSession

    an SAPURLSession implementation that can be used to communicate with the SAP Mobile Services

    endpointsServiceUrl

    the full URL of the endpoints service

    remoteDestinationsEndpointUrl

    the 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

    sapURLSession

    an SAPURLSession implementation that can be used to communicate with the SAP Mobile Services

    settingsParameters

    SAPcpms 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

    completionHandler

    called 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

    settingsParameters

    settingsParameters which will be updated with the destinations

    completionHandler

    called 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

    completionHandler

    A closure that is called when the load operation completes. The closure receives a Result containing either the DestinationResultSet object on success or an Error on 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#>"].remoteURL
    

    Declaration

    Swift

    public func loadRemoteDestinations(to settingsParameters: SAPcpmsSettingsParameters,
                     completionHandler: @escaping (Result<SAPcpmsSettingsParameters, Error>) -> Void)

    Parameters

    settingsParameters

    settingsParameters which will be updated with the remote destinations

    completionHandler

    called when the result received from the server. The closure receives a Result containing either the SAPcpmsSettingsParameters object on success or an Error on failure.