public async Task <IActionResult> ListCrabHouseNumbers( [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromQuery] int?objectId, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <AddressOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, sort, objectId); var cacheKey = CreateCacheKeyForRequestQuery($"legacy/crabhousenumbers-list:{Taal.NL}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync( contentFormat.ContentType, BackendRequest, cacheKey, CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.CrabHuisnummersVolgendeUrl)); }
public async Task <IActionResult> GetPostalCodesFeed( [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IIndex <string, Lazy <IRestClient> > restClients, [FromServices] IOptions <PostalOptions> responseOptions, [FromQuery] long?from, [FromQuery] int?limit, [FromQuery] string embed, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() => CreateBackendSyndicationRequest( "postcodes", from, limit, embed); var value = await GetFromBackendAsync( restClients[RegistryKeys.Postal].Value, BackendRequest, contentFormat.ContentType, HandleBadRequest, cancellationToken); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.Syndication.NextUri)); }
public async Task <IActionResult> AddressMatchWithFormat( [FromRoute] string format, [FromQuery] string gemeentenaam, [FromQuery] string niscode, [FromQuery] string postcode, [FromQuery] string kadStraatcode, [FromQuery] string rrStraatcode, [FromQuery] string straatnaam, [FromQuery] string huisnummer, [FromQuery] string index, [FromQuery] string busnummer, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <AddressOptions> responseOptions, CancellationToken cancellationToken = default) { format = DetermineAndSetFormat(format, actionContextAccessor, Request); var taal = Taal.NL; IRestRequest BackendRequest() => CreateBackendMatchRequest( taal, busnummer, huisnummer, postcode, gemeentenaam, niscode, straatnaam, kadStraatcode, rrStraatcode, index); var response = await GetFromBackendWithBadRequestAsync(format, BackendRequest, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken); return(BackendListResponseResult.Create(response, Request.Query, string.Empty)); }
public async Task <IActionResult> GetPostalCodesFeedWithFormat( [FromRoute] string format, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IIndex <string, Lazy <IRestClient> > restClients, [FromServices] IOptions <PostalOptions> responseOptions, [FromQuery] long?from, [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string embed, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { format = DetermineAndSetFormat(format, actionContextAccessor, Request); IRestRequest BackendRequest() => CreateBackendSyndicationRequest( "postcodes", from, offset, limit, embed); var value = await GetFromBackendAsync( format, restClients["PostalRegistry"].Value, BackendRequest, Request.GetTypedHeaders(), HandleBadRequest, cancellationToken); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.Syndication.NextUri)); }
public async Task <IActionResult> ListMunicipalities( [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <MunicipalityOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); const Taal taal = Taal.NL; IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, taal, sort); var cacheKey = CreateCacheKeyForRequestQuery($"legacy/municipality-list:{taal}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync( contentFormat.ContentType, BackendRequest, cacheKey, CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl)); }
public async Task <IActionResult> ListParcelsWithFormat( [FromRoute] string format, [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <ParcelOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { format = DetermineAndSetFormat(format, actionContextAccessor, Request); var taal = Taal.NL; IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, taal, sort); var cacheKey = CreateCacheKeyForRequestQuery($"legacy/parcel-list:{taal}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync(format, BackendRequest, cacheKey, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync(format, BackendRequest, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl)); }
public async Task <IActionResult> ListBuildings( [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromQuery] string status, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <BuildingOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); const Taal taal = Taal.NL; IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, taal, sort, status); // As long as we do not control WFS, buildings cannot be cached //var cacheKey = CreateCacheKeyForRequestQuery($"legacy/building-list:{taal}"); //var value = await (CacheToggle.FeatureEnabled // ? GetFromCacheThenFromBackendAsync(format, BackendRequest, cacheKey, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken) // : GetFromBackendAsync(format, BackendRequest, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken)); var value = await GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.GebouwVolgendeUrl)); }
public async Task <IActionResult> ListAddressesV2( [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromQuery] string gemeentenaam, [FromQuery] int?postcode, [FromQuery] string straatnaam, [FromQuery] string homoniemToevoeging, [FromQuery] string huisnummer, [FromQuery] string busnummer, [FromQuery] string niscode, [FromQuery] string status, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <AddressOptionsV2> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, [FromServices] IsAddressOsloApiEnabledToggle featureToggle, CancellationToken cancellationToken = default) { if (!featureToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); const Taal taal = Taal.NL; IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, taal, sort, busnummer, huisnummer, postcode, gemeentenaam, straatnaam, homoniemToevoeging, niscode, status); var cacheKey = CreateCacheKeyForRequestQuery($"oslo/address-list:{taal}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync( contentFormat.ContentType, BackendRequest, cacheKey, CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl)); }
public async Task <IActionResult> ListMunicipalitiesV2( [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromQuery] string gemeentenaam, [FromQuery] string status, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <MunicipalityOptionsV2> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, [FromServices] IsMunicipalityOsloApiEnabledToggle featureToggle, CancellationToken cancellationToken = default) { if (!featureToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); const Taal taal = Taal.NL; var isFlemishRegion = GetIsFlemishRegionQueryParameter(); IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, taal, gemeentenaam, sort, status, isFlemishRegion); var cacheKey = CreateCacheKeyForRequestQuery($"oslo/municipality-list:{taal}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync( contentFormat.ContentType, BackendRequest, cacheKey, CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl)); }
public async Task <IActionResult> ListBuildingUnitsV2( [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromQuery] int?adresObjectId, [FromQuery] string status, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <BuildingOptionsV2> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, [FromServices] IsBuildingUnitOsloApiEnabledToggle featureToggle, CancellationToken cancellationToken = default) { if (!featureToggle.FeatureEnabled) { return(NotFound()); } var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); const Taal taal = Taal.NL; IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, taal, adresObjectId, sort, status); var cacheKey = CreateCacheKeyForRequestQuery($"oslo/buildingunit-list:{taal}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync( contentFormat.ContentType, BackendRequest, cacheKey, CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.GebouweenheidVolgendeUrl)); }
public async Task <IActionResult> SearchBestAddMunicipality( [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <MunicipalityOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, [FromBody] BosaMunicipalityRequest searchBody, CancellationToken cancellationToken = default) { var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() => CreateBackendSearchBestAddRequest(searchBody); var value = await GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl)); }
public async Task <IActionResult> SearchBestAddStreetNameWithFormat( [FromRoute] string format, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <MunicipalityOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, [FromBody] BosaStreetNameRequest searchBody, CancellationToken cancellationToken = default) { format = DetermineAndSetFormat(format, actionContextAccessor, Request); IRestRequest BackendRequest() => CreateBackendSearchBestAddRequest(searchBody); var value = await GetFromBackendAsync( format, BackendRequest, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl)); }
public async Task <IActionResult> ListAddressesWithFormat( [FromRoute] string format, [FromQuery] int?offset, [FromQuery] int?limit, [FromQuery] string sort, [FromQuery] string gemeentenaam, [FromQuery] int?postcode, [FromQuery] string straatnaam, [FromQuery] string homoniemToevoeging, [FromQuery] string huisnummer, [FromQuery] string busnummer, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <AddressOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { format = DetermineAndSetFormat(format, actionContextAccessor, Request); const Taal taal = Taal.NL; IRestRequest BackendRequest() => CreateBackendListRequest( offset, limit, taal, sort, busnummer, huisnummer, postcode, gemeentenaam, straatnaam, homoniemToevoeging); var cacheKey = CreateCacheKeyForRequestQuery($"legacy/address-list:{taal}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync(format, BackendRequest, cacheKey, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync(format, BackendRequest, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, responseOptions.Value.VolgendeUrl)); }
public async Task <IActionResult> AddressMatch( [FromQuery] string gemeentenaam, [FromQuery] string niscode, [FromQuery] string postcode, [FromQuery] string kadStraatcode, [FromQuery] string rrStraatcode, [FromQuery] string straatnaam, [FromQuery] string huisnummer, [FromQuery] string index, [FromQuery] string busnummer, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <AddressOptions> responseOptions, [FromServices] ProblemDetailsHelper problemDetailsHelper, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); IRestRequest BackendRequest() => CreateBackendMatchRequest( Taal.NL, busnummer, huisnummer, postcode, gemeentenaam, niscode, straatnaam, kadStraatcode, rrStraatcode, index); var response = await GetFromBackendWithBadRequestAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), problemDetailsHelper, cancellationToken); return(BackendListResponseResult.Create(response, Request.Query, string.Empty)); }
public async Task <IActionResult> ListCrabBuildings( [FromQuery] int?terreinObjectId, [FromQuery] string identificatorTerreinObject, [FromServices] IActionContextAccessor actionContextAccessor, [FromServices] IOptions <AddressOptions> responseOptions, [FromHeader(Name = HeaderNames.IfNoneMatch)] string ifNoneMatch, CancellationToken cancellationToken = default) { var contentFormat = DetermineFormat(actionContextAccessor.ActionContext); if (!terreinObjectId.HasValue && string.IsNullOrEmpty(identificatorTerreinObject)) { throw new ApiException("Er dient minstens één identificator als input te worden meegegeven.", StatusCodes.Status400BadRequest); } IRestRequest BackendRequest() => CreateBackendListRequest( terreinObjectId, identificatorTerreinObject); var cacheKey = CreateCacheKeyForRequestQuery($"legacy/crabgebouwen-list:{Taal.NL}"); var value = await(CacheToggle.FeatureEnabled ? GetFromCacheThenFromBackendAsync( contentFormat.ContentType, BackendRequest, cacheKey, CreateDefaultHandleBadRequest(), cancellationToken) : GetFromBackendAsync( contentFormat.ContentType, BackendRequest, CreateDefaultHandleBadRequest(), cancellationToken)); return(BackendListResponseResult.Create(value, Request.Query, string.Empty)); }