Inherits from NSObject
Declared in LUAPIRequest.h
LUAPIRequest.m

Overview

LUAPIRequest represents a request to the LevelUp API. To perform a request, an LUAPIRequest instance is passed to the performRequest:success:failure method of LUAPIClient. LUAPIRequest instances should usually be created by request builders.

Properties

apiVersion

The version of the LevelUp API to use for this request.

@property (nonatomic, copy) NSString *apiVersion

Discussion

The version of the LevelUp API to use for this request.

Declared In

LUAPIRequest.h

method

The HTTP method of the request: “GET”, “POST”, “PUT”, or “DELETE”.

@property (nonatomic, copy) NSString *method

Discussion

The HTTP method of the request: “GET”, “POST”, “PUT”, or “DELETE”.

Declared In

LUAPIRequest.h

modelFactory

An LUAbstractJSONModelFactory to parse the JSON response.

@property (nonatomic, strong) LUAbstractJSONModelFactory *modelFactory

Discussion

An LUAbstractJSONModelFactory to parse the JSON response.

Declared In

LUAPIRequest.h

parameters

An NSDictionary of values to be passed as parameters.

@property (nonatomic, copy) NSDictionary *parameters

Discussion

An NSDictionary of values to be passed as parameters.

Declared In

LUAPIRequest.h

path

The path component of the URL of the request.

@property (nonatomic, copy) NSString *path

Discussion

The path component of the URL of the request.

Declared In

LUAPIRequest.h

retryResponseCodes

An NSArray of NSNumber response codes which, if received, will cause the request to be repeated by the LUAPIClient every retryTimeInterval, until a successful response is received. The response codes must be defined as acceptable by http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

@property (nonatomic, copy) NSArray *retryResponseCodes

Discussion

An NSArray of NSNumber response codes which, if received, will cause the request to be repeated by the LUAPIClient every retryTimeInterval, until a successful response is received. The response codes must be defined as acceptable by http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Declared In

LUAPIRequest.h

retryTimeInterval

Duration in seconds until a request is repeated.

@property (nonatomic, assign) NSTimeInterval retryTimeInterval

Discussion

Duration in seconds until a request is repeated.

Declared In

LUAPIRequest.h

Class Methods

apiRequestWithMethod:path:apiVersion:parameters:modelFactory:

Returns an LUAPIRequest with the specified method, path and parameters. An authentication token will automatically be included in the request if one is set on the LUAPIClient.

+ (LUAPIRequest *)apiRequestWithMethod:(NSString *)method path:(NSString *)path apiVersion:(NSString *)apiVersion parameters:(NSDictionary *)parameters modelFactory:(LUAbstractJSONModelFactory *)modelFactory

Parameters

method

An HTTP method: “GET”, “POST”, “PUT”, or “DELETE”.

path

The path of the API request, e.g. “/users”.

apiVersion

The version of the API to use.

parameters

A dictionary of parameters to include with this request, or nil if the request has no parameters.

modelFactory

An instance of LUAbstractJSONModelFactory which will parse the response.

Discussion

Returns an LUAPIRequest with the specified method, path and parameters. An authentication token will automatically be included in the request if one is set on the LUAPIClient.

Declared In

LUAPIRequest.h

apiRequestWithMethod:path:apiVersion:parameters:modelFactory:retryResponseCodes:retryTimeInterval:

Returns an LUAPIRequest with the specified method, path and parameters. An authentication token will automatically be included in the request if one is set on the LUAPIClient.

+ (LUAPIRequest *)apiRequestWithMethod:(NSString *)method path:(NSString *)path apiVersion:(NSString *)apiVersion parameters:(NSDictionary *)parameters modelFactory:(LUAbstractJSONModelFactory *)modelFactory retryResponseCodes:(NSArray *)retryResponseCodes retryTimeInterval:(NSTimeInterval)retryTimeInterval

Parameters

method

An HTTP method: “GET”, “POST”, “PUT”, or “DELETE”.

path

The path of the API request, e.g. “/users”.

apiVersion

The version of the API to use.

parameters

A dictionary of parameters to include with this request, or nil if the request has no parameters.

modelFactory

An instance of LUAbstractJSONModelFactory which will parse the response.

retryResponseCodes

An NSArray of response codes which, if received, will cause the request to be repeated by the LUAPIClient every retryTimeInterval, until a successful response is received.

retryTimeInterval

Duration in seconds until a request is repeated.

Discussion

Returns an LUAPIRequest with the specified method, path and parameters. An authentication token will automatically be included in the request if one is set on the LUAPIClient.

Declared In

LUAPIRequest.h

Instance Methods

URL

Returns an NSURL instance for this API request.

- (NSURL *)URL

Discussion

Returns an NSURL instance for this API request.

Declared In

LUAPIRequest.h

URLRequest

Returns an NSMutableURLRequest instance for this API request.

- (NSMutableURLRequest *)URLRequest

Discussion

Returns an NSMutableURLRequest instance for this API request.

Declared In

LUAPIRequest.h