Inherits from NSObject
Declared in MDLFile.h
MDLFile.m

Overview

MDLFile represents a document’s file, as described by Mendeley.

Tasks

Properties

dateAdded

The file added date.

@property (strong, nonatomic) NSDate *dateAdded

Discussion

The file added date.

Declared In

MDLFile.h

document

The file document.

@property (weak, nonatomic) MDLDocument *document

Discussion

The file document.

Declared In

MDLFile.h

extension

The file extension.

@property (copy, nonatomic) NSString *extension

Discussion

The file extension.

Declared In

MDLFile.h

hash

The file hash.

@property (copy, nonatomic) NSString *hash

Discussion

The file hash.

Declared In

MDLFile.h

publicURL

The file public URL.

@property (strong, nonatomic) NSURL *publicURL

Discussion

The file public URL.

Declared In

MDLFile.h

size

The file size.

@property (strong, nonatomic) NSNumber *size

Discussion

The file size.

Declared In

MDLFile.h

Class Methods

fileWithDateAdded:extension:hash:size:document:

Creates a MDLFile and initializes its date added, extension, hash, and size properties.

+ (MDLFile *)fileWithDateAdded:(NSDate *)dateAdded extension:(NSString *)extension hash:(NSString *)hash size:(NSNumber *)size document:(MDLDocument *)document

Parameters

dateAdded

The date added of the file.

extension

The extension of the file.

hash

The hash of the file.

size

The size of the file.

document

The document of the file.

Return Value

The newly-initialized file.

Discussion

Creates a MDLFile and initializes its date added, extension, hash, and size properties.

Declared In

MDLFile.h

fileWithPublicURL:document:

Creates a MDLFile and initializes its public URL property.

+ (MDLFile *)fileWithPublicURL:(NSURL *)publicURL document:(MDLDocument *)document

Parameters

publicURL

The document public URL.

document

The document of the file.

Return Value

The newly-initialized file.

Discussion

Creates a MDLFile and initializes its public URL property.

Declared In

MDLFile.h

Instance Methods

downloadToFileAtPath:progress:success:failure:

Sends a download file API request using the shared client.

- (AFHTTPRequestOperation *)downloadToFileAtPath:(NSString *)path progress:(void ( ^ ) ( NSUInteger bytesRead , long long totalBytesRead , long long totalBytesExpectedToRead ))progress success:(void ( ^ ) ( ))success failure:(void ( ^ ) ( NSError *))failure

Parameters

path

The path to the file to download 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 no argument.

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

Sends a download file API request using the shared client.

Declared In

MDLFile.h