NetworkDataSourceAdapter
NetworkDataSourceAdapter
The NetworkDataSourceAdapter
is an adapter which provides the required methods to handle the network requests.
Its two main features are:
Fetch a page
Check if a page can be fetched.
Page Fetcher
Page fetcher is a structure that enables the library to fetch a specific page from a service call. There are 3 page fetchers, one for each library module.
Given a specific page
and pageSize
, the PageFetcher
provides a way to get a ListResponse<T>
. There are several ListResponse
types that you can use.
NetworkDataSourceAdapter providers
If you know exactly the page or entity count, the library provides a way to generate a NetworkDataSourceAdapter without implementing the canFetch method. If you use either ListResponseWithPageCount
or ListResponseWithEntityCount
you can convert a PageFetcher
to a NetworkDataSourceAdapter
.
To do that Fountain provides some extensions:
These extensions require the first page number, which has to be the same that was used in the Fountain static factory constructor.
Last updated