mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Added convenience accessors on RKObjectManager for the requestCache and requestQueue. Cleaned up some styling and normalized method names.
This commit is contained in:
@@ -120,17 +120,17 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @see RKRequestSerializable
|
||||
*/
|
||||
@interface RKClient : NSObject {
|
||||
NSString* _baseURL;
|
||||
NSString* _username;
|
||||
NSString* _password;
|
||||
NSString *_baseURL;
|
||||
NSString *_username;
|
||||
NSString *_password;
|
||||
BOOL _forceBasicAuthentication;
|
||||
NSMutableDictionary* _HTTPHeaders;
|
||||
RKReachabilityObserver* _baseURLReachabilityObserver;
|
||||
NSString* _serviceUnavailableAlertTitle;
|
||||
NSString* _serviceUnavailableAlertMessage;
|
||||
NSMutableDictionary *_HTTPHeaders;
|
||||
RKReachabilityObserver *_baseURLReachabilityObserver;
|
||||
NSString *_serviceUnavailableAlertTitle;
|
||||
NSString *_serviceUnavailableAlertMessage;
|
||||
BOOL _serviceUnavailableAlertEnabled;
|
||||
RKRequestQueue *_requestQueue;
|
||||
RKRequestCache* _cache;
|
||||
RKRequestCache *_requestCache;
|
||||
RKRequestCachePolicy _cachePolicy;
|
||||
NSMutableSet *_additionalRootCertificates;
|
||||
BOOL _disableCertificateValidation;
|
||||
@@ -155,12 +155,12 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
reachability can be determined. This prevents requests dispatched immediately after
|
||||
client initialization from failing to be sent.
|
||||
*/
|
||||
@property (nonatomic, retain) NSString* baseURL;
|
||||
@property (nonatomic, retain) NSString *baseURL;
|
||||
|
||||
/**
|
||||
* A dictionary of headers to be sent with each request
|
||||
*/
|
||||
@property (nonatomic, readonly) NSMutableDictionary* HTTPHeaders;
|
||||
@property (nonatomic, readonly) NSMutableDictionary *HTTPHeaders;
|
||||
|
||||
/**
|
||||
* Accept all SSL certificates. This is a potential security exposure,
|
||||
@@ -175,7 +175,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
|
||||
*Default*: A new request queue is instantiated for you during init
|
||||
*/
|
||||
@property (nonatomic, retain) RKRequestQueue* requestQueue;
|
||||
@property (nonatomic, retain) RKRequestQueue *requestQueue;
|
||||
|
||||
/**
|
||||
* Will check for network connectivity to the host specified in the baseURL
|
||||
@@ -193,7 +193,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param header The HTTP header to add
|
||||
* @see HTTPHeaders
|
||||
*/
|
||||
- (void)setValue:(NSString*)value forHTTPHeaderField:(NSString*)header;
|
||||
- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)header;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/// @name SSL Validation
|
||||
@@ -204,7 +204,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* A set of additional certificates to be used in evaluating server
|
||||
* SSL certificates.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSSet* additionalRootCertificates;
|
||||
@property(nonatomic, readonly) NSSet *additionalRootCertificates;
|
||||
|
||||
/**
|
||||
* Adds an additional certificate that will be used to evaluate server SSL certs
|
||||
@@ -222,12 +222,12 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
/**
|
||||
* The username to use for authentication via HTTP AUTH
|
||||
*/
|
||||
@property(nonatomic, retain) NSString* username;
|
||||
@property(nonatomic, retain) NSString *username;
|
||||
|
||||
/**
|
||||
* The password to use for authentication via HTTP AUTH
|
||||
*/
|
||||
@property(nonatomic, retain) NSString* password;
|
||||
@property(nonatomic, retain) NSString *password;
|
||||
|
||||
/**
|
||||
When YES, RKRequest objects dispatched through the client will have an HTTP Basic
|
||||
@@ -248,7 +248,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
*
|
||||
* @see RKReachabilityObserver
|
||||
*/
|
||||
@property(nonatomic, readonly) RKReachabilityObserver* baseURLReachabilityObserver;
|
||||
@property(nonatomic, readonly) RKReachabilityObserver *baseURLReachabilityObserver;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/// @name Service Availability Alerting
|
||||
@@ -260,7 +260,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
*
|
||||
* *Default*: _"Service Unavailable"_
|
||||
*/
|
||||
@property(nonatomic, retain) NSString* serviceUnavailableAlertTitle;
|
||||
@property(nonatomic, retain) NSString *serviceUnavailableAlertTitle;
|
||||
|
||||
/**
|
||||
* The message to use in the alert shown when a request encounters a
|
||||
@@ -268,7 +268,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
*
|
||||
* *Default*: _"The remote resource is unavailable. Please try again later."_
|
||||
*/
|
||||
@property(nonatomic, retain) NSString* serviceUnavailableAlertMessage;
|
||||
@property(nonatomic, retain) NSString *serviceUnavailableAlertMessage;
|
||||
|
||||
/**
|
||||
* Flag that determines whether the Service Unavailable alert is shown in response
|
||||
@@ -286,7 +286,13 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
An instance of the request cache used to store/load cacheable responses for requests
|
||||
sent through this client
|
||||
*/
|
||||
@property (nonatomic, retain) RKRequestCache* cache;
|
||||
@property (nonatomic, retain) RKRequestCache *cache DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
An instance of the request cache used to store/load cacheable responses for requests
|
||||
sent through this client
|
||||
*/
|
||||
@property (nonatomic, retain) RKRequestCache *requestCache;
|
||||
|
||||
/**
|
||||
The default cache policy to apply for all requests sent through this client
|
||||
@@ -298,7 +304,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
/**
|
||||
The path used to store response data for this client's request cache
|
||||
*/
|
||||
@property (nonatomic, readonly) NSString* cachePath;
|
||||
@property (nonatomic, readonly) NSString *cachePath;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/// @name Shared Client Instance
|
||||
@@ -307,14 +313,14 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
/**
|
||||
* Return the configured singleton instance of the client
|
||||
*/
|
||||
+ (RKClient*)sharedClient;
|
||||
+ (RKClient *)sharedClient;
|
||||
|
||||
/**
|
||||
* Set the shared singleton issue of the client, releasing the current singleton (if any)
|
||||
*
|
||||
* @param client The RKClient instance to set as the new singleton
|
||||
*/
|
||||
+ (void)setSharedClient:(RKClient*)client;
|
||||
+ (void)setSharedClient:(RKClient *)client;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/// @name Initializing a Client
|
||||
@@ -327,7 +333,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @see baseURL
|
||||
* @return A configured RKClient instance ready to send requests
|
||||
*/
|
||||
+ (RKClient*)clientWithBaseURL:(NSString*)baseURL;
|
||||
+ (RKClient *)clientWithBaseURL:(NSString *)baseURL;
|
||||
|
||||
/**
|
||||
* Return a Rest client scoped to a particular base URL with a set of HTTP AUTH credentials.
|
||||
@@ -338,7 +344,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param password The password to use for HTTP Authentication challenges
|
||||
* @return A configured RKClient instance ready to send requests
|
||||
*/
|
||||
+ (RKClient*)clientWithBaseURL:(NSString*)baseURL username:(NSString*)username password:(NSString*)password;
|
||||
+ (RKClient *)clientWithBaseURL:(NSString *)baseURL username:(NSString *)username password:(NSString *)password;
|
||||
|
||||
/**
|
||||
* Return a client scoped to a particular base URL. If the singleton client is nil, the return client is set as the singleton
|
||||
@@ -347,7 +353,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @see baseURL
|
||||
* @return A configured RKClient instance ready to send requests
|
||||
*/
|
||||
- (id)initWithBaseURL:(NSString*)baseURL;
|
||||
- (id)initWithBaseURL:(NSString *)baseURL;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/// @name Constructing Resource Paths and URLs
|
||||
@@ -359,7 +365,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param resourcePath The resource path to build a URL against
|
||||
* @return An NSURL constructed by concatenating the baseURL and the resourcePath
|
||||
*/
|
||||
- (NSURL*)URLForResourcePath:(NSString*)resourcePath;
|
||||
- (NSURL *)URLForResourcePath:(NSString *)resourcePath;
|
||||
|
||||
/**
|
||||
* Returns an NSString by adding a resource path to the base URL
|
||||
@@ -367,7 +373,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param resourcePath The resource path to build a URL against
|
||||
* @return A string URL constructed by concatenating the baseURL and the resourcePath
|
||||
*/
|
||||
- (NSString*)URLPathForResourcePath:(NSString*)resourcePath;
|
||||
- (NSString *)URLPathForResourcePath:(NSString *)resourcePath;
|
||||
|
||||
/**
|
||||
* Returns a resource path with a dictionary of query parameters URL encoded and appended
|
||||
@@ -385,7 +391,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @see RKPathAppendQueryParams()
|
||||
* @deprecated Use RKPathAppendQueryParams instead
|
||||
*/
|
||||
- (NSString*)resourcePath:(NSString*)resourcePath withQueryParams:(NSDictionary*)queryParams DEPRECATED_ATTRIBUTE;
|
||||
- (NSString *)resourcePath:(NSString *)resourcePath withQueryParams:(NSDictionary *)queryParams DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
* Returns a NSURL by adding a resource path to the base URL and appending a URL encoded set of query parameters
|
||||
@@ -400,7 +406,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param queryParams A dictionary of query parameters to be URL encoded and appended to the resource path
|
||||
* @return A URL constructed by concatenating the baseURL and the resourcePath with the query parameters appended
|
||||
*/
|
||||
- (NSURL*)URLForResourcePath:(NSString *)resourcePath queryParams:(NSDictionary*)queryParams;
|
||||
- (NSURL *)URLForResourcePath:(NSString *)resourcePath queryParams:(NSDictionary *)queryParams;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
/// @name Building Requests
|
||||
@@ -414,7 +420,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @see username
|
||||
* @see password
|
||||
*/
|
||||
- (void)setupRequest:(RKRequest*)request;
|
||||
- (void)setupRequest:(RKRequest *)request;
|
||||
|
||||
/**
|
||||
* Return a request object targetted at a resource path relative to the base URL. By default the method is set to GET
|
||||
@@ -425,7 +431,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @return A fully configured RKRequest instance ready for sending
|
||||
* @see RKRequestDelegate
|
||||
*/
|
||||
- (RKRequest*)requestWithResourcePath:(NSString*)resourcePath delegate:(NSObject<RKRequestDelegate>*)delegate;
|
||||
- (RKRequest *)requestWithResourcePath:(NSString *)resourcePath delegate:(NSObject<RKRequestDelegate> *)delegate;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -444,7 +450,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param delegate A delegate object to inform of the results
|
||||
* @return The RKRequest object built and sent to the remote system
|
||||
*/
|
||||
- (RKRequest*)get:(NSString*)resourcePath delegate:(NSObject<RKRequestDelegate>*)delegate;
|
||||
- (RKRequest *)get:(NSString *)resourcePath delegate:(NSObject<RKRequestDelegate> *)delegate;
|
||||
|
||||
/**
|
||||
* Fetch a resource via an HTTP GET with a dictionary of params
|
||||
@@ -457,7 +463,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param delegate A delegate object to inform of the results
|
||||
* @return The RKRequest object built and sent to the remote system
|
||||
*/
|
||||
- (RKRequest*)get:(NSString*)resourcePath queryParams:(NSDictionary*)queryParams delegate:(NSObject<RKRequestDelegate>*)delegate;
|
||||
- (RKRequest *)get:(NSString *)resourcePath queryParams:(NSDictionary *)queryParams delegate:(NSObject<RKRequestDelegate> *)delegate;
|
||||
|
||||
/**
|
||||
* Create a resource via an HTTP POST with a set of form parameters
|
||||
@@ -468,7 +474,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @return The RKRequest object built and sent to the remote system
|
||||
* @see RKRequestSerializable
|
||||
*/
|
||||
- (RKRequest*)post:(NSString*)resourcePath params:(NSObject<RKRequestSerializable>*)params delegate:(NSObject<RKRequestDelegate>*)delegate;
|
||||
- (RKRequest *)post:(NSString *)resourcePath params:(NSObject<RKRequestSerializable> *)params delegate:(NSObject<RKRequestDelegate> *)delegate;
|
||||
|
||||
/**
|
||||
* Update a resource via an HTTP PUT
|
||||
@@ -479,7 +485,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @return The RKRequest object built and sent to the remote system
|
||||
* @see RKRequestSerializable
|
||||
*/
|
||||
- (RKRequest*)put:(NSString*)resourcePath params:(NSObject<RKRequestSerializable>*)params delegate:(NSObject<RKRequestDelegate>*)delegate;
|
||||
- (RKRequest *)put:(NSString*)resourcePath params:(NSObject<RKRequestSerializable> *)params delegate:(NSObject<RKRequestDelegate> *)delegate;
|
||||
|
||||
/**
|
||||
* Destroy a resource via an HTTP DELETE
|
||||
@@ -488,6 +494,6 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
|
||||
* @param delegate A delegate object to inform of the results
|
||||
* @return The RKRequest object built and sent to the remote system
|
||||
*/
|
||||
- (RKRequest*)delete:(NSString*)resourcePath delegate:(NSObject<RKRequestDelegate>*)delegate;
|
||||
- (RKRequest *)delete:(NSString*)resourcePath delegate:(NSObject<RKRequestDelegate> *)delegate;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user