Inherits from AFOAuth1Client
Declared in MDLMendeleyAPIClient.h
MDLMendeleyAPIClient.m

Overview

MDLMendeleyAPIClient is an HTTP client preconfigured for accessing Mendeley Open API.

Tasks

Properties

automaticAuthenticationEnabled

When enabled, automatic authentication launch the authentication process upon receiving network responses with status code = 401. This is YES by default.

@property (getter=isAutomaticAuthenticationEnabled) BOOL automaticAuthenticationEnabled

Discussion

When enabled, automatic authentication launch the authentication process upon receiving network responses with status code = 401. This is YES by default.

Declared In

MDLMendeleyAPIClient.h

rateLimitRemainingForLatestRequest

Number of calls you can still do within the next hour for the latest request. This is NSNotFound by default. Note that the default rate limit for calls varies depending on the method being requested.

@property (assign, nonatomic) NSInteger rateLimitRemainingForLatestRequest

Discussion

Number of calls you can still do within the next hour for the latest request. This is NSNotFound by default. Note that the default rate limit for calls varies depending on the method being requested.

Declared In

MDLMendeleyAPIClient.h

Class Methods

resetSharedClient

Deallocates the singleton instance returned by sharedClient.

+ (void)resetSharedClient

Discussion

Deallocates the singleton instance returned by sharedClient.

Declared In

MDLMendeleyAPIClient.h

sharedClient

Creates and initializes if needed a singleton instance of a MDLMendeleyAPIClient object configured with Mendeley Open API URL.

+ (MDLMendeleyAPIClient *)sharedClient

Return Value

The newly-initialized client

Discussion

Creates and initializes if needed a singleton instance of a MDLMendeleyAPIClient object configured with Mendeley Open API URL.

Declared In

MDLMendeleyAPIClient.h

Instance Methods

authenticateWithSuccess:failure:

Creates an authentication request, and enqueues it to the HTTP client’s operation queue.

- (void)authenticateWithSuccess:(void ( ^ ) ( AFOAuth1Token *))success failure:(void ( ^ ) ( NSError *))failure

Parameters

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes one argument: the newly acquired access token.

failure

A block object to be executed when the request operation finishes unsuccessfully. This block has no return value and takes one argument: the NSError object describing the network or authentication error that occurred.

Discussion

Creates an authentication request, and enqueues it to the HTTP client’s operation queue.

Declared In

MDLMendeleyAPIClient.h

authenticateWithWebAuthorizationCallback:success:failure:

Creates an authentication request with in-app web authorization callback, and enqueues it to the HTTP client’s operation queue.

- (void)authenticateWithWebAuthorizationCallback:(void ( ^ ) ( NSURL *))webAuthorizationCallback success:(void ( ^ ) ( AFOAuth1Token *))success failure:(void ( ^ ) ( NSError *))failure

Parameters

webAuthorizationCallback

A block object to be executed when the request operation needs to switch to the web-based authorization process. This block has no return value and takes one argument: the URL for its authorization request.

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes one argument: the newly acquired access token.

failure

A block object to be executed when the request operation finishes unsuccessfully. This block has no return value and takes one argument: the NSError object describing the network or authentication error that occurred.

Discussion

Creates an authentication request with in-app web authorization callback, and enqueues it to the HTTP client’s operation queue.

Declared In

MDLMendeleyAPIClient.h

deletePath:parameters:success:failure:

Creates an AFHTTPRequestOperation with a DELETE request, and enqueues it to the HTTP client’s operation queue.

- (void)deletePath:(NSString *)path parameters:(NSDictionary *)parameters success:(void ( ^ ) ( AFHTTPRequestOperation *, id ))success failure:(void ( ^ ) ( NSError *))failure

Parameters

path

The path to be appended to the HTTP client’s base URL and used as the request URL.

parameters

The parameters of the request.

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the deserialized JSON object created from the response data of request.

failure

A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data. This block has no return value and takes one argument: the NSError object describing the network or parsing error that occurred.

Discussion

Creates an AFHTTPRequestOperation with a DELETE request, and enqueues it to the HTTP client’s operation queue.

Declared In

MDLMendeleyAPIClient.h

getPath:requiresAuthentication:parameters:outputStreamToFileAtPath:progress:success:failure:

Creates an AFHTTPRequestOperation with a GET request, setup outstream to a file, and enqueues it to the HTTP client’s operation queue.

- (AFHTTPRequestOperation *)getPath:(NSString *)path requiresAuthentication:(BOOL)requiresAuthentication parameters:(NSDictionary *)parameters outputStreamToFileAtPath:(NSString *)filePath progress:(void ( ^ ) ( NSUInteger bytesRead , long long totalBytesRead , long long totalBytesExpectedToRead ))progress success:(void ( ^ ) ( AFHTTPRequestOperation *, id ))success failure:(void ( ^ ) ( NSError *))failure

Parameters

path

The path to be appended to the HTTP client’s base URL and used as the request URL.

requiresAuthentication

A boolean value that corresponds to whether the resource requires authentication.

parameters

The parameters of the request.

filePath

The path to the file output stream to.

progress

A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the NSHTTPURLResponse object. This block may be called multiple times, and will execute on the main thread.

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the deserialized JSON object created from the response data of request.

failure

A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data. This block has no return value and takes one argument: the NSError object describing the network or parsing error that occurred.

Return Value

A new HTTP request operation

Discussion

Creates an AFHTTPRequestOperation with a GET request, setup outstream to a file, and enqueues it to the HTTP client’s operation queue.

Declared In

MDLMendeleyAPIClient.h

getPath:requiresAuthentication:parameters:success:failure:

Creates an AFHTTPRequestOperation with a GET request, and enqueues it to the HTTP client’s operation queue.

- (void)getPath:(NSString *)path requiresAuthentication:(BOOL)requiresAuthentication parameters:(NSDictionary *)parameters success:(void ( ^ ) ( AFHTTPRequestOperation *, id ))success failure:(void ( ^ ) ( NSError *))failure

Parameters

path

The path to be appended to the HTTP client’s base URL and used as the request URL.

requiresAuthentication

A boolean value that corresponds to whether the resource requires authentication

parameters

The parameters of the request.

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the deserialized JSON object created from the response data of request.

failure

A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data. This block has no return value and takes one argument: the NSError object describing the network or parsing error that occurred.

Discussion

Creates an AFHTTPRequestOperation with a GET request, and enqueues it to the HTTP client’s operation queue.

Declared In

MDLMendeleyAPIClient.h

postPath:bodyKey:bodyContent:success:failure:

Creates an AFHTTPRequestOperation with a POST request, and enqueues it to the HTTP client’s operation queue.

- (void)postPath:(NSString *)path bodyKey:(NSString *)bodyKey bodyContent:(id)bodyContent success:(void ( ^ ) ( AFHTTPRequestOperation *, id ))success failure:(void ( ^ ) ( NSError *))failure

Parameters

path

The path to be appended to the HTTP client’s base URL and used as the request URL.

bodyKey

The key for the object to be encoded and set in the request HTTP body.

bodyContent

The object to be encoded and set in the request HTTP body.

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the deserialized JSON object created from the response data of request.

failure

A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data. This block has no return value and takes one argument: the NSError object describing the network or parsing error that occurred.

Discussion

Creates an AFHTTPRequestOperation with a POST request, and enqueues it to the HTTP client’s operation queue.

Declared In

MDLMendeleyAPIClient.h

putPath:fileAtURL:success:failure:

Creates an AFHTTPRequestOperation with a PUT request, and enqueues it to the HTTP client’s operation queue.

- (void)putPath:(NSString *)path fileAtURL:(NSURL *)fileURL success:(void ( ^ ) ( AFHTTPRequestOperation *, id ))success failure:(void ( ^ ) ( NSError *))failure

Parameters

path

The path to be appended to the HTTP client’s base URL and used as the request URL.

fileURL

The local URL for the object to be encoded and set in the request HTTP body.

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request.

failure

A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data. This block has no return value and takes one argument: the NSError object describing the network or parsing error that occurred.

Discussion

Creates an AFHTTPRequestOperation with a PUT request, and enqueues it to the HTTP client’s operation queue.

Declared In

MDLMendeleyAPIClient.h