Click or drag to resize

IRequestProcessor Interface

Processes API requests into API responses.

Namespace: DegreeDays.Api
Assembly: DegreeDays (in DegreeDays.dll) Version: 1.4
Syntax
public interface IRequestProcessor

The IRequestProcessor type exposes the following members.

Methods
 NameDescription
Public methodProcess Processes the Request object and returns a Response object which is either a FailureResponse or a Response that's type is the counterpart to that of the Request object passed in. For example, successful processing of a LocationDataRequest will result in a LocationDataResponse.
Top
Remarks

You might not want to use this interface directly, since DegreeDaysApi provides a much more usable interface. But all the API requests that you make through a DegreeDaysApi object will be processed internally by an IRequestProcessor. However you use the API, an implementation of this interface will be doing all the work of sending requests to the API servers and getting responses back.

Using a mock IRequestProcessor for testing

You might want to make or use a mock implementation of this interface for testing your application. Such a mock implementation only needs to work for the types of Request that your application makes (it doesn't necessarily need to be able to handle all types of Request).

If you create a DegreeDaysApi object with a mock implementation of IRequestProcessor, then all the requests you make though that DegreeDaysApi object will be processed by your mock IRequestProcessor.

Customizing parts of the processing

By default this client library uses a default instance of XmlHttpRequestProcessor - that's what DegreeDaysApi will create and use internally if you don't give it a specific IRequestProcessor to use. In most cases the defaults are ideal. But you can easily customize the processing that the XmlHttpRequestProcessor does. You might, for example, want to change the endpoint URL, or swap the default System.net-based IHttpRequestDispatcher for one that uses an alternative implementation (e.g. if your app uses an alternative HTTP library elsewhere). See the XmlHttpRequestProcessor docs for more on how to do this sort of thing.

See Also