RequestBuilder class

Acts as a configuration based runtime switch between Request or ODPRequest.

Syntax

@interface RequestBuilder : NSObject

Members

All members of RequestBuilder, including inherited members.

Methods
Method Description
+ (void) cancelAllRequestsInQueue This is an API to help clear the Queue of all queued requests.
+ (void) clearPendingRequestsWithError: (NSError *) error Clears all requests in the persistent queue.
+ (void) enablePerformanceLogging: (BOOL) enable Enable performance logging support.
+ (void) enableTracing: (BOOL) value_in Switches traceability status, the default is NO.
+ (void) enableXCSRF: (BOOL) enable Enable XCSRF support.
+ (id) getDelegate Returns the delegate to be invoked in Offline mode.
+ (SEL) getDidFailSelector Returns the selector registered for Offline mode.
+ (SEL) getDidFinishSelector Returns the selector registered for Offline mode.
+ (int) getTraceLevel Returns the trace level set.
+ (BOOL) isOfflineEnabled Returns a BOOL value indicating if Offline mode is enabled.
+ (BOOL) isPerformanceLoggingEnabled Returns performance logging status (default is NO).
+ (BOOL) isTracingEnabled Returns tracing status (default is NO).
+ (id< Requesting >) requestWithURL: (NSURL *) newURL Factory method which returns a request object.
+ (id< Requesting >) requestWithURL: (NSURL *) newURL usingCache: (id< CacheDelegate >) cache Factory method which returns a request object created using url and cache.
+ (id< Requesting >) requestWithURL: (NSURL *) newURL usingCache: (id< CacheDelegate >) cache andCachePolicy: (ECachePolicy) policy Factory method which returns a request object created using url, cache and a cache policy.
+ (enum ERequestType) retrieveRequestType Helper method to retrieve the request type to be instantiated from NSUserDefaults.
+ (void) setDelegate: (id) delegate Clients need to register their custom selectors to be invoked in Offline mode.
+ (void) setDidFailSelector: (SEL) selector Clients need to register their custom selectors to be invoked in Offline mode.
+ (void) setDidFinishSelector: (SEL) selector Clients need to register their custom selectors to be invoked in Offline mode.
+ (void) setRequestType: (const enum ERequestType) type_in Helper method to store the request type to be instantiated; the builder decides which class (Request or SUPRequest) should be instantiated based on this value.
+ (void) setTraceLevel: (TraceLevel) value_in Set the trace level, default is MEDIUM.

Usage

The provided factory methods can return a valid Request, but we cannot guarantee this for ODPRequest. However, as the SUPRequest library and public headers are not bundled with Connectivity lib, we attempt to create the SUPRequest class using NSClassFromString("SUPRequest"). NSClassFromString will work correctly only if: a) the SUPRequest library and the public header are added to the client project b) the -ObjC value is added to the Other Linker Flags