<TRCRequest> Protocol Reference

The TRCRequest implementation manages request composing and response handling at same time. More...

Inheritance diagram for <TRCRequest>:

Instance Methods

(NSString *) - path
 Provide endpoint here. More...
 
(TRCRequestMethod- method
 Specify one of HTTP methods type here. More...
 

Detailed Description

The TRCRequest implementation manages request composing and response handling at same time.

Each TRCRequest implementation represents one API call which does one function.

Any information and logic, specific for that API call should be placed inside implementation of TRCRequest. Then you can easily manage your requests: just add one more TRCRequest implementation and this means adding one more API call. Same for deletion, no need to change something else somewhere in the app. Only TRCRequest and it's usage in the app.

TRCRequest implementations should be lite. If see that something can be reused, check if it can be done via TRCObjectMapper, TRCValueTransformer, TRCConnection. I thought to place here only information specific to API call (i.e. can't be reused)

Most methods, related to request composing, starts from request prefix. At same time, method related tot response processing, starts from response prefix

Method Documentation

◆ path()

- (NSString *) path
required

Provide endpoint here.

It can be relative path as well as absolute path to endpoint (matching by http: or https: prefix) I.e. if path starts from http:// or https://, then it used as absolute URL, in other case path would be appended into base URL, specified in connection.

If your URL has dynamic parts, you can mark them as path argument via curly braces like this: order/{id} that means that url has one argument named 'id' and it will be replaced by real value specified in TRCRequest.pathParameters.

See also
TRCRequest.pathParameters

◆ method()

- (TRCRequestMethod) method
required

Specify one of HTTP methods type here.

TRCRequestMethod is NSString, so if you server requires some custom, non-standard HTTP method, just return it here as NSString

See also
TRCRequestMethod