示例#1
0
        public async Task <IEnumerable <T> > GetCollatedData(string baseQuery)
        {
            IFundaOfferHttpClient <T> client = fundaOfferHttpClientfactory.GetFundaOfferHttpClient();

            ApiCallResult <FundaApiResponse <T> > response;
            List <T> results     = new List <T>();
            int      currentPage = 0;

            do
            {
                currentPage++;

                response = await client.GetOffer(GetPaginatedQuery(baseQuery, currentPage));

                if (!response.IsSuccess)
                {
                    return(null);
                }

                results.AddRange(response.Body.Objects);
            }while (response.Body.Paging.AantalPaginas > response.Body.Paging.HuidigePagina);

            return(results);
        }
 public FundaOfferHttpClientCachingDecorator(IFundaOfferHttpClient <T> decoratedClient, IMemoryCache memoryCache, IOptions <FundaApiConfiguration> options)
 {
     this.decoratedClient = decoratedClient;
     this.memoryCache     = memoryCache;
     cachingTimeInSeconds = options.Value.RequestCacheDurationInSeconds;
 }
示例#3
0
 public FundaOfferHttpClientRateLimiterDecorator(IFundaOfferHttpClient <T> decoratedClient, IRequestThrottling requestThrottling)
 {
     this.decoratedClient   = decoratedClient;
     this.requestThrottling = requestThrottling;
 }