Skip to Content
0
Dec 13, 2022 at 10:32 AM

Defining URL Parameters for Proxy Class Requests

436 Views Last edit Dec 13, 2022 at 10:46 AM 2 rev

Hello together,

is there a option for defining URL Parameters like "sap-client" while using the generated Proxy Class Methods/OnlineODataProvider for all Request which will be sent to the OData Service via a Instance of OnlineODataProvider? The OData Service is not connected via a Destination in the Mobile Service and I need to make the client changeable inside the App itself to request the right System/Client.

Currently I add the follwing to make the "sap-client" changeable.

func loadProperty(_ completionHandler: @escaping ([ActionCodeAssignment]?, Error?) -> Void) {
        
        var query:DataQuery = DataQuery()
        var map = StringMap()
            map.updateValue(AppDelegate.shared.client, forKey: "sap-client")
        query.customOptions = map
        dataService.loadProperty(Documents.toActionCodes, into: entity, query: query) { error in
            self.hideFioriLoadingIndicator()
            if let error = error {
                completionHandler(nil, error)
                return
            }
            completionHandler(self.entity.toActionCodes, nil)
        }
}
But the Problem is that the query Parameter is not present in all Methods like createMedia of the OnlineODataProvider, so I can't add the needed URL Parameter.
open func createMedia(entity: SAPOData.EntityValue, content: SAPOData.StreamBase, headers: SAPOData.HTTPHeaders? = nil, options: SAPOData.RequestOptions? = nil, completionHandler: @escaping (Error?) -> Void)
If anyone knows a way to specify URL Parameters for the "sap-client" on a central level please let me know.PS: Adding the Parameter to the root URL of the OnlineODataProvider is not working, since the Proxy Class Methods will add more Parameter to that URL which won't work.