<TRCResponseSerializer > Protocol Reference

Defines protocol for objects which converts NSData of response body into responseObject More...

Inheritance diagram for <TRCResponseSerializer >:

Instance Methods

(id) - objectFromResponseData:error:
 Converts NSData of response body into responseObject which would be used in parsing, validation or just as result. More...
 
(BOOL) - isCorrectContentType:
 Check that NSData content-type correct before processing here. More...
 

Detailed Description

Defines protocol for objects which converts NSData of response body into responseObject

Main method is objectFromResponseData:error:, which does all work, plus another optional method isCorrectContentType: used to validate content-type

Method Documentation

◆ objectFromResponseData:error:()

- (id TRCResponseSerializer) objectFromResponseData: (NSData *)  data
error: (NSError **)  error 

Converts NSData of response body into responseObject which would be used in parsing, validation or just as result.

Parameters
datainput NSData
errorwrite NSError into that pointer if error happens
Returns
responseObject which would be used as result

◆ isCorrectContentType:()

- (BOOL TRCResponseSerializer) isCorrectContentType: (NSString *)  responseContentType
optional

Check that NSData content-type correct before processing here.

If this method not implemented or returns nil, then validation avoided.

Parameters
responseContentTypeinput content-type string
Returns
YES if content-type correct otherwise NO. If content-type is not correct, error would be produces as result