<TRCPostProcessor> Protocol Reference

TRCPostProcessor is per-request post-processor. More...

Inheritance diagram for <TRCPostProcessor>:

Instance Methods

(id) - postProcessResponseObject:forRequest:postProcessError:
 This method invokes at the end of response processing. More...
 
(NSError *) - postProcessError:forRequest:
 Useful to handle all errors from RestClient in one place, and replace them with own error with own error codes. More...
 
(TRCQueueType) - queueType
 Specify queue type to run this post processor. More...
 

Detailed Description

TRCPostProcessor is per-request post-processor.

This post-processor useful when you want centralized place to modify all response objects. You can check for TRCRequest.customProperties here for targeting (or use another criteria for that)

Note
If more than one TRCPostProcessor registered, then result chaining, i.e. output of postProcessor1 used as input for postProcessor2: (object —> postProcessor1 –> postProcessor2 –> ... –> result) This rule correct for both method in that protocol

Method Documentation

◆ postProcessResponseObject:forRequest:postProcessError:()

- (id) postProcessResponseObject: (id)  responseObject
forRequest: (id< TRCRequest >)  request
postProcessError: (NSError **)  error 
optional

This method invokes at the end of response processing.

The result of this method would be used instead of input responseObject. Sometime it's useful to post-process all responseObjects in one centralized place, for example to wire circular dependencies in received object graph.

◆ postProcessError:forRequest:()

- (NSError *) postProcessError: (id)  responseError
forRequest: (id< TRCRequest >)  request 
optional

Useful to handle all errors from RestClient in one place, and replace them with own error with own error codes.

◆ queueType()

- (TRCQueueType) queueType
optional

Specify queue type to run this post processor.

Used TRCQueueTypeWork if not specified