SPiDRequest Class Reference
| Inherits from | NSObject |
| Conforms to | NSURLConnectionDelegate |
| Declared in | SPiDRequest.h SPiDRequest.m |
Tasks
Other Methods
-
retryCountproperty
Public methods
-
+ apiGetRequestWithPath:completionHandler:Creates a GET
SPiDRequest -
+ apiPostRequestWithPath:body:completionHandler:Creates a POST
SPiDRequest -
+ requestWithPath:method:body:completionHandler:Creates a
SPiDRequest -
– startRequestWithAccessTokenRuns the request with the current access token
-
– startRequestRuns the request without access token
Private methods
-
– initGetRequestWithPath:completionHandler:Initializes a GET
SPiDRequest -
– initPostRequestWithPath:body:completionHandler:Initializes a POST
SPiDRequest -
– initRequestWithPath:method:body:completionHandler:Initializes a
SPiDRequest -
– startRequestWithURL:body:Starts a SPiD request
-
– connection:willSendRequest:redirectResponse:‘NSURLConnectionDelegate’ method
-
– connection:didReceiveData:‘NSURLConnectionDelegate’ method
-
– connectionDidFinishLoading:NSURLConnectionDelegate method
-
– connection:didFailWithError:NSURLConnectionDelegate method
Class Methods
apiGetRequestWithPath:completionHandler:
Creates a GET SPiDRequest
+ (SPiDRequest *)apiGetRequestWithPath:(NSString *)requestPath completionHandler:(void ( ^ ) ( SPiDResponse *response ))completionHandlerParameters
- requestPath
API path for GET request e.g. /user
- completionHandler
Completion handler run after request is finished
Return Value
SPiDRequest
Declared In
SPiDRequest.hapiPostRequestWithPath:body:completionHandler:
Creates a POST SPiDRequest
+ (SPiDRequest *)apiPostRequestWithPath:(NSString *)requestPath body:(NSDictionary *)body completionHandler:(void ( ^ ) ( SPiDResponse *response ))completionHandlerParameters
- requestPath
API path for POST request e.g. /user
- body
The HTTP body
- completionHandler
Completion handler run after request is finished
Return Value
SPiDRequest
Declared In
SPiDRequest.hrequestWithPath:method:body:completionHandler:
Creates a SPiDRequest
+ (SPiDRequest *)requestWithPath:(NSString *)requestPath method:(NSString *)method body:(NSDictionary *)body completionHandler:(void ( ^ ) ( SPiDResponse *response ))completionHandlerParameters
- requestPath
API path for request
- method
HTTP method for the request
- body
HTTP body, used if method is POST
- completionHandler
Completion handler run after request is finished
Return Value
SPiDRequest
Declared In
SPiDRequest.hInstance Methods
connection:didFailWithError:
NSURLConnectionDelegate method
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)errorParameters
- connection
The connection sending the message.
- error
An error object containing details of why the connection failed to load the request successfully.
Discussion
Sent when a connection fails to load its request successfully.
Declared In
SPiDRequest.mconnection:didReceiveData:
‘NSURLConnectionDelegate’ method
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)dataParameters
- connection
The connection sending the data.
- data
The newly available data.
Discussion
Sent as a connection loads message incrementally and concatenates the message to the private instance variable ‘_receivedData’.
Declared In
SPiDRequest.mconnection:willSendRequest:redirectResponse:
‘NSURLConnectionDelegate’ method
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)responseParameters
- connection
The connection sending the message.
- request
The proposed redirected request.
- response
The URL response that caused the redirect
Return Value
The actual URL request to use in light of the redirection response.
Discussion
Sent when the connection determines that it must change URLs in order to continue loading a request.
Declared In
SPiDRequest.mconnectionDidFinishLoading:
NSURLConnectionDelegate method
- (void)connectionDidFinishLoading:(NSURLConnection *)connectionParameters
- connection
The connection sending the message.
Discussion
Sent when a connection has finished loading successfully.
Declared In
SPiDRequest.minitGetRequestWithPath:completionHandler:
Initializes a GET SPiDRequest
- (id)initGetRequestWithPath:(NSString *)requestPath completionHandler:(void ( ^ ) ( SPiDResponse *response ))completionHandlerParameters
- requestPath
Path to endpoint
- completionHandler
Called on request completion or error
Return Value
SPiDRequest
Declared In
SPiDRequest.minitPostRequestWithPath:body:completionHandler:
Initializes a POST SPiDRequest
- (id)initPostRequestWithPath:(NSString *)requestPath body:(NSDictionary *)body completionHandler:(void ( ^ ) ( SPiDResponse *response ))completionHandlerParameters
- requestPath
Path to endpoint
- body
The post body
- completionHandler
Called on request completion or error
Return Value
SPiDRequest
Declared In
SPiDRequest.minitRequestWithPath:method:body:completionHandler:
Initializes a SPiDRequest
- (id)initRequestWithPath:(NSString *)requestPath method:(NSString *)method body:(NSDictionary *)body completionHandler:(void ( ^ ) ( SPiDResponse *response ))completionHandlerParameters
- requestPath
Path to endpoint
- method
Http request method
- body
The post body
- completionHandler
Called on request completion or error
Return Value
SPiDRequest
Declared In
SPiDRequest.m