Example #1
0
        private async Task <List <ZoekAanbodResponse> > GetAllPages(AanbodRequest aanbodRequest)
        {
            var aanbodResponseList = new List <ZoekAanbodResponse>();
            ZoekAanbodResponse aanbodResponse;

            do
            {
                aanbodResponse = await _aanbodClient.ZoekAanbodAsync(aanbodRequest.GenerateNextRequest());

                aanbodResponseList.Add(aanbodResponse);
            }while (aanbodResponse.HasMorePages());

            return(aanbodResponseList);
        }
Example #2
0
        /// <inheritdoc/>
        public async Task <FundaResponse> GetKoopaanbodForLocation(string location, bool hasGarden)
        {
            var           aanbodRequest = new AanbodRequest(location, hasGarden);
            FundaResponse response;

            try
            {
                var aanbodResponseList = await GetAllPages(aanbodRequest);

                response = MapResultUtil.MapResponse(aanbodResponseList, hasGarden, location);
            }
            catch (Exception ex)
            {
                ((AanbodClient)_aanbodClient).Abort();
                response = MapResultUtil.MapFailure();
            }
            finally
            {
                await((AanbodClient)_aanbodClient).CloseAsync();
            }
            return(response);
        }