Inherits from AGBaseAdapter : NSObject
Conforms to AGPipe
Declared in AGRESTPipe.h
AGRESTPipe.m

Overview

An internal AGPipe implementation that uses REST as the communication transport.

IMPORTANT: Users are not required to instantiate this class directly, instead an instance of this class is returned automatically when a Pipe with default configuration is constructed or with the type config option set to “REST”. See AGPipeline and AGPipe class documentation for more information.

Instance Methods

cancel

Cancel all running pipe operations. Doing so will invoke the pipe’s ‘failure’ block with an error code set to NSURLErrorCancelled so that you can perform your ‘cancellation’ logic.

- (void)cancel

Discussion

Cancel all running pipe operations. Doing so will invoke the pipe’s ‘failure’ block with an error code set to NSURLErrorCancelled so that you can perform your ‘cancellation’ logic.

Note: Calling cancel has no effect on the server, so if you do a save or remove and then call cancel, that action will still take place on the the server.

Declared In

AGPipe.h

read:failure:

Reads all the data from the underlying server connection.

- (void)read:(void ( ^ ) ( id responseObject ))success failure:(void ( ^ ) ( NSError *error ))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 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 response data. This block has no return value and takes one argument: The NSError object describing the network or parsing error that occurred.

Discussion

Reads all the data from the underlying server connection.

Declared In

AGPipe.h

read:success:failure:

Read specific object from the underlying server connection.

- (void)read:(id)value success:(void ( ^ ) ( id responseObject ))success failure:(void ( ^ ) ( NSError *error ))failure

Parameters

value

The value of the recordId. See property [AGPipeConfig recordId].

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes one argument: 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 response data. This block has no return value and takes one argument: The NSError object describing the network or parsing error that occurred.

Discussion

Read specific object from the underlying server connection.

Declared In

AGPipe.h

readWithParams:success:failure:

Reads all the data that matches a given parameter provider from the underlying server connection.

- (void)readWithParams:(NSDictionary *)parameterProvider success:(void ( ^ ) ( id responseObject ))success failure:(void ( ^ ) ( NSError *error ))failure

Parameters

parameterProvider

A dictionary containing all the parameters and their values, that are passed to the server. If no parameterProvider is given, the defaults from the AGPipeConfig are used.

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes one argument: 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 response data. This block has no return value and takes one argument: The NSError object describing the network or parsing error that occurred.

Discussion

Reads all the data that matches a given parameter provider from the underlying server connection.

Declared In

AGPipe.h

remove:success:failure:

Removes an object from the underlying server connection.

- (void)remove:(NSDictionary *)object success:(void ( ^ ) ( id responseObject ))success failure:(void ( ^ ) ( NSError *error ))failure

Parameters

object

a ‘JSON’ map, representing the data to remove. Note the map must have the ‘recordId’ key set. See property [AGPipeConfig recordId].

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes one argument: 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 response data. This block has no return value and takes one argument: The NSError object describing the network or parsing error that occurred.

Discussion

Removes an object from the underlying server connection.

Declared In

AGPipe.h

save:success:failure:

Saves (or updates) a given object from the underlying server connection.

- (void)save:(NSDictionary *)object success:(void ( ^ ) ( id responseObject ))success failure:(void ( ^ ) ( NSError *error ))failure

Parameters

object

a ‘JSON’ map, representing the data to save/update. If the map contains values of NSURL objects that point to local files, a multi-part request will be constructed to upload the files to the server. To track progress of the upload, call [AGPipe setUploadProgressBlock:].

success

A block object to be executed when the request operation finishes successfully. This block has no return value and takes one argument: 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 response data. This block has no return value and takes one argument: The NSError object describing the network or parsing error that occurred.

Discussion

Saves (or updates) a given object from the underlying server connection.

Declared In

AGPipe.h

setUploadProgressBlock:

Sets a progress status callback that is invoked during uploading of a file(s).

- (void)setUploadProgressBlock:(void ( ^ ) ( NSUInteger bytesWritten , long long totalBytesWritten , long long totalBytesExpectedToWrite ))block

Parameters

block

The block accepts three arguments: the number of bytes written in the latest write, the total bytes written for this connection, and the total bytes expected to be written during the request determined by the length of the HTTP body.

NOTE. The block can be called several times and is always executed on the main thread.

Discussion

Sets a progress status callback that is invoked during uploading of a file(s).

Declared In

AGPipe.h