SAPcpmsSettingsParameters

public struct SAPcpmsSettingsParameters

Structure to hold SAPcpms settings metadata. E.g. on which host can be found the given application by applicationID. Extra information could be store for the device and user specific settings.

  • Host information of the backend

    Declaration

    Swift

    public var backendURL: URL
  • ID of the application on the server

    Declaration

    Swift

    public var applicationID: String
  • Unique device identifier

    Declaration

    Swift

    public var deviceID: String?
  • Version of the application

    Declaration

    Swift

    public var applicationVersion: String?
  • The configured destinations related to the application;

    Declaration

    Swift

    public var destinations: [String : String]?
  • Static default value for application version. Uses the CFBundleShortVersionString from the info.plist of the application

    Declaration

    Swift

    public static let defaultApplicationVersion: String?
  • Static default value for application identifier. Uses the bundleIdentifier obtaining information about the main bundle.

    Declaration

    Swift

    public static let defaultApplicationID: String?
  • Static default value for deviceID, because the operation to get it is time-consuming. It only gets evaluated the first time it is accessed, so it does not need to be computed over and over again.

    Declaration

    Swift

    public static let defaultDeviceID: String?
  • Static default value for deviceID, because the operation to get it is time-consuming. It only gets evaluated the first time it is accessed, so it does not need to be computed over and over again.

    Declaration

    Swift

    @available(*, deprecated, renamed: "defaultDeviceID")
    public static let uuid: String?
  • Default initializer

    Declaration

    Swift

    public init(backendURL: URL, applicationID: String? = defaultApplicationID, deviceID: String? = defaultDeviceID, applicationVersion: String? = defaultApplicationVersion, destinations: [String: String]? = nil)

    Parameters

    backendURL

    the URL of the server only with the host information

    applicationID

    mandatory information with the application ID defined on the server. Default value: the main bundle’s bundle identifier

    deviceID

    optional information to get device specific settings. DeviceID will be concatenated to the URL. Default value: Device identifier for vendor

    applicationVersion

    optional information to check the application version. Default value: the main bundle’s bundle short version

    destinations

    optional information to get the name and the path of the configured destinations belonging to the applicationID

  • Returns the URL of the destination belonging the given name parameter

    Declaration

    Swift

    public func url(forDestination name: String) -> URL?

    Parameters

    name

    name of the destination; configured on mobile services

    Return Value

    the URL of the destination belonging the given name parameter; If it does not exist the returned value will be nil.

  • Parses the SAPcpmsSettingsParameters part of the Discovery Service configuration object.

    {
      "auth": [{
          "type": <#String#>,
          "config": <#[String: String]#>
      }],
      "host": "<#host URL string#>",
      "port": 443,
      "protocol": "https"
    }
    

    The backend URL is constructed using the ‘host’, ‘port’ and ‘protocol’ parameters. The constructed URL must be valid according to RFC 3986: https://www.ietf.org/rfc/rfc3986.txt otherwise an error is thrown.

    Throws

    ConfigurationError if a key is missing or the object has invalid structure

    Declaration

    Swift

    public init(discoveryServiceConfig config: Any) throws

    Parameters

    discoveryServiceConfig

    The Disovery Service configuration object.

  • Parses the SAPcpmsSettingsParameters part of the Discovery Service configuration object.

    {
      "auth": [{
          "type": <#String#>,
          "config": <#[String: String]#>
      }],
      "host": "<#host URL string#>",
      "port": 443,
      "protocol": "https"
    }
    

    The backend URL is constructed using the ‘host’, ‘port’ and ‘protocol’ parameters. The constructed URL must be valid according to RFC 3986: https://www.ietf.org/rfc/rfc3986.txt otherwise an error is thrown.

    Throws

    ConfigurationError if a key is missing or the object has invalid structure

    Declaration

    Swift

    public init(applicationID: String, discoveryServiceConfig config: Any) throws

    Parameters

    applicationID

    The applicationID

    config

    The Disovery Service configuration object.

  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public var debugDescription: String { get }