This category declares additional methods to extend TyphoonRestClient
with additional formats and serializations.
More...
Instance Methods | |
(void) | - registerRequestSerializer:forName: |
Registers TRCRequestSerializer for special string identifier TRCSerialization . More... | |
(void) | - registerResponseSerializer:forName: |
Registers TRCResponseSerializer for special string identifier TRCSerialization . More... | |
(void) | - registerSchemeFormat:forFileExtension: |
Registers scheme file format in TyphoonRestClient . More... | |
(void) | - registerValidationErrorPrinter:forFormatWithFileExtension: |
Registers validation error printer for schema file extension. More... | |
(void) | - registerTRCValueTransformerType:withValueClass: |
Registers TRCValueTransformerType with objective-c class. More... | |
This category declares additional methods to extend TyphoonRestClient
with additional formats and serializations.
- (void) registerRequestSerializer: | (id< TRCRequestSerializer >) | serializer | |
forName: | (TRCSerialization) | serializerName | |
Registers TRCRequestSerializer
for special string identifier TRCSerialization
.
Use TRCSerialization
identifier later in your TRCRequest
-s
Extends class TyphoonRestClient.
- (void) registerResponseSerializer: | (id< TRCResponseSerializer >) | serializer | |
forName: | (TRCSerialization) | serializerName | |
Registers TRCResponseSerializer
for special string identifier TRCSerialization
.
Use TRCSerialization
identifier later in your TRCRequest
-s
Extends class TyphoonRestClient.
- (void) registerSchemeFormat: | (id< TRCSchemaFormat >) | schemeFormat | |
forFileExtension: | (NSString *) | extension | |
Registers scheme file format in TyphoonRestClient
.
You are free to invent your own schema format to process and validate your own serialization formats.
By default, only one format available for schema. It's JSON format (with file extension 'json')
All scheme files must have path extensions of registered scheme format. For example all JSON schemes must ends with .json extension
TRCSchemaFormat
Extends class TyphoonRestClient.
- (void) registerValidationErrorPrinter: | (id< TRCValidationErrorPrinter >) | printer | |
forFormatWithFileExtension: | (NSString *) | extension | |
Registers validation error printer for schema file extension.
Because schema files with different extensions, looks different, then full description of validation error should also looks different per extension.
TRCValidationErrorPrinter
Extends class TyphoonRestClient.
- (void) registerTRCValueTransformerType: | (TRCValueTransformerType *) | type | |
withValueClass: | (Class) | clazz | |
Registers TRCValueTransformerType
with objective-c class.
Then TRCValueTransformerType
can be used as identifier in TRCValueTransformer
to specify input types, and type validation would be done based on classes registered with it.
To use TRCValueTransformerType
as identifier, it useful to have them as global variable in serializer header, and register pointer to that variables with classes. Calling that method will set correct value to these variables.
Note that value of type
variable would be set as BitMask, so you can later combine all acceptable types as one value like that: type1 | type2 | type3
TRCValueTransformerType
Extends class TyphoonRestClient.