RestClient

@objc
public class RestClient : NSObject

This class is responsible to handle REST API request, and acts as HTTP client for SDK Core

Property

  • Singleton instance for RestClient

    Declaration

    Swift

    @objc
    public static let shared: RestClient

Invoke

  • Invokes REST API Request with Request object

    Declaration

    Swift

    public func invoke(request: Request, action: Action? = nil, completion: @escaping ResultCallback)

    Parameters

    request

    Request object for API request which should contain all information regarding the request

    action

    Optional Action object that represents a type of Request

    completion

    Result completion callback

  • Invokes synchronously REST API Request with Request object

    Declaration

    Swift

    public func invokeSync(request: Request, action: Action? = nil) -> Result

    Parameters

    request

    Request object for API request which should contain all information regarding the request

    action

    Optional Action object that represents a type of Request

    Return Value

    Result instance of API Request

Config

  • Sets custom URLSessionConfiguration for RestClient’s URLSession object

    Declaration

    Swift

    @objc
    public func setURLSessionConfiguration(config: URLSessionConfiguration)

    Parameters

    config

    custom URLSessionConfiguration object

  • Sets custom URLSessionConfiguration and delegate Handler for RestClient’s URLSession object. This can be used to set SSL Pinning handling

    Declaration

    Swift

    public func setURLSessionConfiguration(config: URLSessionConfiguration?, handler: FRURLSessionHandler?)

    Parameters

    config

    custom URLSessionConfiguration object

    handler

    custom FRURLSessionHandler object