From 1036aceea1ae1e4a0c0176d451512997694bf6cb Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Fri, 4 Jun 2021 17:02:19 +0200 Subject: [PATCH 1/4] Target framework is now .NET 5 Replace Newtonsoft.Json.* with System.Text.Json.* Replace GeoJSON.Net with Azure.Core.GeoJson (experimental!!) --- .../AzureMapsRestToolkit.csproj | 23 +- .../AzureMapsRestToolkit/AzureMapsServices.cs | 215 +++++++----------- .../Common/BaseServices.cs | 128 +++++------ .../AzureMapsRestToolkit/Common/Batch.cs | 11 + .../AzureMapsRestToolkit/Common/BatchItem.cs | 14 ++ .../AzureMapsRestToolkit/Common/Error.cs | 3 + .../Common/ErrorResponse.cs | 10 +- .../AzureMapsRestToolkit/Common/Extensions.cs | 2 +- .../Data/MapDataDetailInfo.cs | 11 +- .../Data/MapDataListResponse.cs | 5 +- .../AzureMapsRestToolkit/Data/UploadResult.cs | 5 +- .../GeoJson/LineString.cs | 7 +- .../GeoJson/MultiPoint.cs | 7 +- .../AzureMapsRestToolkit/GeoJson/Polygon.cs | 7 +- .../Geolocation/CountryRegion.cs | 5 +- .../Geolocation/IpAddressToLocationResult.cs | 3 + .../IAzureMapsServices.cs | 13 +- .../AzureMapsRestToolkit/Mobility/Agency.cs | 12 +- .../AzureMapsRestToolkit/Mobility/Alert.cs | 12 +- .../Mobility/Direction.cs | 8 +- .../AzureMapsRestToolkit/Mobility/Leg.cs | 6 +- .../Mobility/LineGroup.cs | 6 +- .../Mobility/MetroAreaInfoResponse.cs | 11 +- .../Mobility/MetroAreaRequest.cs | 8 +- .../Mobility/MetroAreaResponse.cs | 5 +- .../Mobility/MetroAreaResult.cs | 8 +- .../Mobility/RealTimeArrivalResult.cs | 7 +- .../Mobility/ResultViewport.cs | 7 +- .../AzureMapsRestToolkit/Mobility/Stop.cs | 6 +- .../Mobility/TransitObjectResult.cs | 13 +- .../Mobility/TransitTypeResult.cs | 10 +- .../Render/CopyrightCaptionResult.cs | 7 +- .../Render/CopyrightTileResult.cs | 9 +- .../AzureMapsRestToolkit/Render/Country.cs | 5 +- .../AzureMapsRestToolkit/Render/Region.cs | 7 +- .../AzureMapsRestToolkit/Route/Coordinate.cs | 7 +- .../Route/PostRoutDirectionsRequest.cs | 2 +- .../Route/RouteDirectionsResponse.cs | 5 +- .../Route/RouteDirectionsResult.cs | 11 +- .../Route/RouteDirectionsSummary.cs | 13 +- .../AzureMapsRestToolkit/Route/RouteMatrix.cs | 7 +- .../Route/RouteMatrixRequest.cs | 11 +- .../Route/RouteMatrixResponse.cs | 9 +- .../Route/RouteMatrixResponseSummary.cs | 15 +- .../Route/RouteMatrixRouteSummary.cs | 5 +- .../Route/RouteMatrixSummary.cs | 7 +- .../Route/RouteOptimizedWaypoint.cs | 7 +- .../AzureMapsRestToolkit/Route/RouteRange.cs | 7 +- .../Route/RouteRangeResponse.cs | 5 +- .../Route/RouteRequestBase.cs | 2 +- .../Route/RouteResponseBase.cs | 13 +- .../Route/RouteResponseReport.cs | 5 +- .../RouteResponseReportEffectiveSetting.cs | 7 +- .../Route/RouteResultGuidance.cs | 7 +- .../Route/RouteResultInstruction.cs | 30 +-- .../Route/RouteResultInstructionGroup.cs | 11 +- .../Route/RouteResultLeg.cs | 7 +- .../Route/RouteResultLegSummary.cs | 23 +- .../Route/RouteResultSection.cs | 21 +- .../Route/RouteResultSectionTec.cs | 7 +- .../Route/RouteResultSectionTecCause.cs | 7 +- .../Route/VehicleEngineType.cs | 2 +- .../Search/CoordinateAbbreviated.cs | 6 +- .../Search/DataSources.cs | 4 +- .../Search/DataSourcesGeometry.cs | 4 +- ...ityTypes.cs => SearchAddressEntityType.cs} | 8 +- .../Search/SearchAddressResponse.cs | 6 +- .../Search/SearchAddressResult.cs | 20 +- .../SearchAddressReverseCrossStreetRequest.cs | 2 +- ...SearchAddressReverseCrossStreetResponse.cs | 6 +- .../Search/SearchAddressReverseRequest.cs | 4 +- .../Search/SearchAddressReverseResponse.cs | 6 +- .../Search/SearchAddressReverseResult.cs | 6 +- .../Search/SearchAddressReverseSummary.cs | 6 +- .../Search/SearchAddressStructuredResponse.cs | 6 +- .../Search/SearchAddressStructuredResult.cs | 8 +- .../Search/SearchAddressStructuredSummary.cs | 6 +- .../Search/SearchAlongRouteResponse.cs | 6 +- .../Search/SearchAlongRouteResult.cs | 6 +- .../Search/SearchFuzzyRequest.cs | 2 +- .../Search/SearchFuzzyResponse.cs | 6 +- .../Search/SearchFuzzyResult.cs | 12 +- .../Search/SearchGeometryResponse.cs | 6 +- .../Search/SearchGeometryResult.cs | 6 +- .../Search/SearchNearbyPoiResult.cs | 6 +- .../Search/SearchNearbyRequest.cs | 10 +- .../Search/SearchNearbyResponse.cs | 6 +- .../Search/SearchNearbySummary.cs | 4 +- .../Search/SearchPoiCategoryResponse.cs | 6 +- .../Search/SearchPoiResponse.cs | 6 +- .../Search/SearchRequestBase.cs | 2 +- .../Search/SearchRequestBaseExtended.cs | 8 +- .../Search/SearchResult.cs | 18 +- .../Search/SearchResultAddress.cs | 40 ++-- .../Search/SearchResultAddressRanges.cs | 10 +- .../Search/SearchResultEntryPoint.cs | 6 +- .../Search/SearchResultPoi.cs | 12 +- .../Search/SearchResultPoiClassification.cs | 6 +- .../SearchResultPoiClassificationName.cs | 6 +- .../Search/SearchResultViewport.cs | 6 +- .../Search/SearchSummary.cs | 16 +- .../Search/SearchSummaryGeoBias.cs | 2 +- .../Spatial/ClosestPointResultEntry.cs | 8 +- .../Spatial/ClosestPointSummary.cs | 8 +- .../Spatial/Coordinate.cs | 6 +- .../Spatial/GeofenceGeometry.cs | 14 +- .../Spatial/GetBufferResponse.cs | 8 +- .../Spatial/GetClosestPointResponse.cs | 6 +- .../Spatial/GetGeofenceResponse.cs | 10 +- .../Spatial/GetPointInPolygonSummary.cs | 8 +- .../Spatial/GreatCircleDistanceResponse.cs | 6 +- .../Spatial/PointInPolygonResponse.cs | 6 +- .../Spatial/PointInPolygonResult.cs | 6 +- .../Spatial/PostPointInPolygonResponse.cs | 6 +- .../Spatial/PostPointInPolygonSummary.cs | 6 +- .../AzureMapsRestToolkit/Spatial/Result.cs | 4 +- .../AzureMapsRestToolkit/Spatial/Summary.cs | 6 +- .../AzureMapsRestToolkit/Timezone/IanaId.cs | 10 +- .../Timezone/TimezoneIanaVersionResult.cs | 4 +- .../Timezone/TimezoneResult.cs | 10 +- .../Traffic/Coordinates.cs | 4 +- .../Traffic/FlowSegmentData.cs | 18 +- .../AzureMapsRestToolkit/Traffic/Point.cs | 6 +- .../AzureMapsRestToolkit/Traffic/Tm.cs | 6 +- .../Traffic/TrafficFlowSegmentRequest.cs | 4 +- .../Traffic/TrafficFlowSegmentResult.cs | 4 +- .../Traffic/TrafficFlowTileRequest.cs | 6 +- .../Traffic/TrafficIncidentDetailResult.cs | 4 +- .../Traffic/TrafficIncidentPoi.cs | 28 +-- .../Traffic/TrafficIncidentViewportResult.cs | 4 +- .../Traffic/TrafficRequestTileBase.cs | 8 +- .../Traffic/TrafficState.cs | 6 +- .../AzureMapsRestToolkit/Traffic/ViewpResp.cs | 10 +- .../AzureMapsToolkit-Core-Test.csproj | 15 +- AzureMapsToolkit-Core-Test/UnitTest.cs | 138 +++++------ 135 files changed, 814 insertions(+), 760 deletions(-) create mode 100644 AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Batch.cs create mode 100644 AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BatchItem.cs rename AzureMapsRestToolkit/AzureMapsRestToolkit/Search/{SearchAddressEntityTypes.cs => SearchAddressEntityType.cs} (64%) diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsRestToolkit.csproj b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsRestToolkit.csproj index d59c0ec..3a01e4b 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsRestToolkit.csproj +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsRestToolkit.csproj @@ -1,22 +1,29 @@  - netstandard2.0 + net5.0 true .Net standard library for Azure Maps Services https://github.com/perfahlen/AzureMapsRestServices - https://github.com/perfahlen/AzureMapsRestServices/blob/master/LICENSE - https://github.com/perfahlen/AzureMapsRestServices + https://github.com/perfahlen/AzureMapsRestServicet + true + true + true + snupkg GIT - Azure Maps REST Toolkit - 6.0.0 - 6.0.0.0 + .NET Azure Maps REST API + 7.0.0 + 7.0.0.0 AzureMapsToolkit - 6.0.0.0 + 7.0.0.0 + Per Fahlen,Vincent Baaij + © 2021 + MIT - + + diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs index 164ea8a..bd083ad 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs @@ -12,28 +12,28 @@ using AzureMapsToolkit.Spatial; using System.Net.Http; using AzureMapsToolkit.Data; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; using System.Globalization; using AzureMapsToolkit.Mobility; -using Newtonsoft.Json.Schema; +//using Newtonsoft.Json.Schema; using AzureMapsToolkit.Route; using System.Text; -using Newtonsoft.Json.Linq; +using Azure.Core.GeoJson; +//using Newtonsoft.Json.Linq; namespace AzureMapsToolkit { public class AzureMapsServices : BaseServices, IAzureMapsServices { - - - string Format { get { return "json"; } } + //static string Format { get { return "json"; } } private readonly string baseDomain; + private readonly JsonSerializerOptions serializerOptions; /// - /// + /// /// /// public AzureMapsServices(string key, string baseDomain = "https://atlas.microsoft.com") : base(key) @@ -45,11 +45,10 @@ public AzureMapsServices(string key, string baseDomain = "https://atlas.microsof this.baseDomain = baseDomain; - JsonConvert.DefaultSettings = () => - new JsonSerializerSettings - { - ContractResolver = new CamelCasePropertyNamesContractResolver() - }; + serializerOptions = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase + }; } #region Mobility @@ -168,15 +167,11 @@ public async Task> PostPointInPolygon(PostP var url = $"{baseDomain}/spatial/pointInPolygon/json?subscription-key={base.Key}{query}"; - using (var response = await GetHttpResponseMessage(url, geoJson, HttpMethod.Post)) - { - using (var responseMessage = response.Content) - { - var responseData = await responseMessage.ReadAsStringAsync(); - var res = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData); - return new Response { Result = res }; - } - } + using var response = await GetHttpResponseMessage(url, geoJson, HttpMethod.Post); + using var responseMessage = response.Content; + var responseData = await responseMessage.ReadAsStringAsync(); + var res = JsonSerializer.Deserialize(responseData); + return new Response { Result = res }; } catch (AzureMapsException ex) @@ -199,15 +194,11 @@ public async Task> PostGeofence(PostGeofenceRequest r var url = $"{baseDomain}/spatial/geofence/json?subscription-key={base.Key}{query}"; - using (var response = await GetHttpResponseMessage(url, geoJson, HttpMethod.Post)) - { - using (var responseMessage = response.Content) - { - var responseData = await responseMessage.ReadAsStringAsync(); - var res = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData); - return new Response { Result = res }; - } - } + using var response = await GetHttpResponseMessage(url, geoJson, HttpMethod.Post); + using var responseMessage = response.Content; + var responseData = await responseMessage.ReadAsStringAsync(); + var res = JsonSerializer.Deserialize(responseData); + return new Response { Result = res }; } catch (AzureMapsException ex) @@ -229,15 +220,11 @@ public async Task> PostClosestPoint(PostClosestPo var query = base.GetQuery(req, true); var url = $"{baseDomain}/spatial/closestPoint/json?subscription-key={base.Key}{query}"; - using (var response = await GetHttpResponseMessage(url, geoJson, HttpMethod.Post)) - { - using (var responseMessage = response.Content) - { - var responseData = await responseMessage.ReadAsStringAsync(); - var res = Newtonsoft.Json.JsonConvert.DeserializeObject(responseData); - return new Response { Result = res }; - } - } + using var response = await GetHttpResponseMessage(url, geoJson, HttpMethod.Post); + using var responseMessage = response.Content; + var responseData = await responseMessage.ReadAsStringAsync(); + var res = JsonSerializer.Deserialize(responseData); + return new Response { Result = res }; } catch (AzureMapsException ex) @@ -348,21 +335,17 @@ public virtual async Task> DeleteData(Guid udid) { try { - var url = $"{baseDomain}/mapData/{udid.ToString()}?subscription-key={Key}&api-version=1.0"; + var url = $"{baseDomain}/mapData/{udid}?subscription-key={Key}&api-version=1.0"; - using (var client = new HttpClient()) - { - using (var request = new HttpRequestMessage(HttpMethod.Delete, url)) - { + using var client = new HttpClient(); + using var request = new HttpRequestMessage(HttpMethod.Delete, url); - var response = await client.DeleteAsync(url); + var response = await client.DeleteAsync(url); - if (response.StatusCode == System.Net.HttpStatusCode.NoContent) - return new Response { Result = true }; - throw new AzureMapsException(new ErrorResponse { Error = new Error() { Message = $"Didn't recieve 204 statuscode, recieved {response.StatusCode.ToString()}" } }); - } - } + if (response.StatusCode == System.Net.HttpStatusCode.NoContent) + return new Response { Result = true }; + throw new AzureMapsException(new ErrorResponse { Error = new Error() { Message = $"Didn't recieve 204 statuscode, recieved {response.StatusCode}" } }); } catch (AzureMapsException ex) { @@ -381,19 +364,12 @@ public virtual async Task> Download(string udid) { var url = $"{baseDomain}/mapData/{udid}?subscription-key={Key}&api-version=1.0"; - using (var client = new HttpClient()) - { - using (var request = new HttpRequestMessage(HttpMethod.Get, url)) - { - - using (var response = await client.GetAsync(url)) - { - var geojson = response.Content.ReadAsStringAsync().Result; - return new Response { Result = geojson }; - } + using var client = new HttpClient(); + using var request = new HttpRequestMessage(HttpMethod.Get, url); - } - } + using var response = await client.GetAsync(url); + var geojson = response.Content.ReadAsStringAsync().Result; + return new Response { Result = geojson }; } catch (AzureMapsException ex) { @@ -402,7 +378,7 @@ public virtual async Task> Download(string udid) } /// - /// This API allows the caller to fetch a list of all content uploaded previously using the Data Upload API.ít + /// This API allows the caller to fetch a list of all content uploaded previously using the Data Upload API.ít /// /// public virtual async Task> GetList() @@ -439,7 +415,7 @@ public virtual async Task> Upload(string geoJson, string // make another request and wait for the request is processed by the service var udidUrl = $"{location}&subscription-key={this.Key}"; string udid = GetUdidFromLocation(udidUrl); - var uploadResult = Newtonsoft.Json.JsonConvert.DeserializeObject(udid); + var uploadResult = JsonSerializer.Deserialize(udid); return new Response { Result = new UploadResult { Udid = uploadResult.Udid } }; } @@ -466,13 +442,13 @@ public virtual async Task> Update(Guid udid, string geoJs throw new ArgumentException("GeoJson paramater cannot be empty or null"); } - var url = $"{baseDomain}/mapData/{udid.ToString()}?api-version=1.0&subscription-key={Key}"; + var url = $"{baseDomain}/mapData/{udid}?api-version=1.0&subscription-key={Key}"; var res = await GetHttpResponseMessage(url, geoJson, HttpMethod.Put); var location = res.Headers.GetValues("Location").First(); var udidUrl = $"{location}&subscription-key={this.Key}"; string sUdid = GetUdidFromLocation(udidUrl); - var updateResult = Newtonsoft.Json.JsonConvert.DeserializeObject(sUdid); + var updateResult = JsonSerializer.Deserialize(sUdid,serializerOptions); return new Response { Result = new UpdateResult { Udid = updateResult.Udid } }; } catch (AzureMapsException ex) @@ -613,7 +589,7 @@ public virtual async Task> GetMapImageryTile(MapImageryTileRequ } /// - /// Fetches map tiles in vector or raster format typically to be integrated into a new map control or SDK. By default, Azure uses vector map tiles for its web map control + /// Fetches map tiles in vector or raster format typically to be integrated into a new map control or SDK. By default, Azure uses vector map tiles for its web map control /// /// public virtual async Task> GetMapTile(MapTileRequest req) @@ -659,7 +635,7 @@ public virtual async Task> GetRouteDirections( /// /// This service will calculate a set of locations that can be reached from the origin point based on fuel, energy, or time budget that is specified. A polygon boundary (or Isochrone) is returned in a counterclockwise orientation as well as the precise polygon center which was the result of the origin point. - /// + /// /// The returned polygon can be used for further processing such as Search Inside Geometry to search for POIs within the provided Isochrone /// /// @@ -688,11 +664,9 @@ public virtual async Task> GetRouteRange(RouteRange var queryContent = GetQuerycontent(queryCollection); - using (var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post)) - { - var resultUrl = responseMessage.Headers.Location.AbsoluteUri; - return (resultUrl, null); - } + using var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post); + var resultUrl = responseMessage.Headers.Location.AbsoluteUri; + return (resultUrl, null); } catch (Exception ex) { @@ -707,7 +681,7 @@ public virtual async Task> GetRouteRange(RouteRange /// - /// The Matrix Routing service allows calculation of a matrix of route summaries for a set of routes defined by origin and destination locations. For every given origin, this service calculates the cost of routing from that origin to every given destination. The set of origins and the set of destinations can be thought of as the column and row headers of a table and each cell in the table contains the costs of routing from the origin to the destination for that cell. For each route, the travel times and distances are calculated. You can use the computed costs to determine which routes to calculate using the Routing Directions API. If the computation takes longer than 20 seconds or forceAsyn parameter in the request is set to true, this API returns a 202 response code along a redirect URL in the Location field of the response header. This URL should be checked periodically until the response data or error information is available. + /// The Matrix Routing service allows calculation of a matrix of route summaries for a set of routes defined by origin and destination locations. For every given origin, this service calculates the cost of routing from that origin to every given destination. The set of origins and the set of destinations can be thought of as the column and row headers of a table and each cell in the table contains the costs of routing from the origin to the destination for that cell. For each route, the travel times and distances are calculated. You can use the computed costs to determine which routes to calculate using the Routing Directions API. If the computation takes longer than 20 seconds or forceAsyn parameter in the request is set to true, this API returns a 202 response code along a redirect URL in the Location field of the response header. This URL should be checked periodically until the response data or error information is available. /// The asynchronous responses are stored for 14 days. The redirect URL returns a 400 response if used after the expiration period. /// /// @@ -721,8 +695,8 @@ public virtual async Task> GetRouteRange(RouteRange var url = $"{baseDomain}/route/matrix/json?subscription-key={Key}"; url += GetQuery(routeMatrixRequest, true); - var originPoints = GetMultipPoint(coordinatesOrigins); - var destinationsPoint = GetMultipPoint(coordinatesDestinations); + var originPoints = GetMultiPoint(coordinatesOrigins); + var destinationsPoint = GetMultiPoint(coordinatesDestinations); var body = new { @@ -730,12 +704,10 @@ public virtual async Task> GetRouteRange(RouteRange destinations = destinationsPoint }; - string data = Newtonsoft.Json.JsonConvert.SerializeObject(body); + string data = JsonSerializer.Serialize(body); - using (var response = await GetHttpResponseMessage(url, data, HttpMethod.Post)) - { - return (response.Headers.Location.AbsoluteUri, null); // .Location.AbsoluteUri; - } + using var response = await GetHttpResponseMessage(url, data, HttpMethod.Post); + return (response.Headers.Location.AbsoluteUri, null); // .Location.AbsoluteUri; } catch (Exception ex) { @@ -750,17 +722,15 @@ public virtual async Task> GetRouteRange(RouteRange /// public virtual async Task> GetRouteMatrixResult(string url) { - using (var client = GetClient(url)) - { - var routeMatrixResponse = await base.GetData(client, url); - var response = GetResponse(routeMatrixResponse); - return response; - } + using var client = GetClient(url); + var routeMatrixResponse = await GetData(client, url); + var response = GetResponse(routeMatrixResponse); + return response; //using (var client = GetClient(url)) //{ // var res = await client.GetStringAsync(url); - // var routeMatrixResponse = Newtonsoft.Json.JsonConvert.DeserializeObject(res); + // var routeMatrixResponse = JsonSerializer.Deserialize(res); // var response = GetResponse(routeMatrixResponse); // return response; //} @@ -883,12 +853,10 @@ public virtual async Task> GetSearchPOICateg var queryContent = GetQuerycontent(queryCollection); - using (var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post)) - { + using var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post); - var resultUrl = responseMessage.Headers.Location.AbsoluteUri; - return (resultUrl, null); - } + var resultUrl = responseMessage.Headers.Location.AbsoluteUri; + return (resultUrl, null); } catch (Exception ex) @@ -911,11 +879,9 @@ public virtual async Task> GetSearchPOICateg var queryContent = GetQuerycontent(queryCollection); - using (var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post)) - { - var resultUrl = responseMessage.Headers.Location.AbsoluteUri; - return (resultUrl, null); - } + using var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post); + var resultUrl = responseMessage.Headers.Location.AbsoluteUri; + return (resultUrl, null); } catch (Exception ex) @@ -938,21 +904,18 @@ public virtual async Task> GetSearchAlongRout { var bodyContent = new { route = lineString }; - var queryContent = Newtonsoft.Json.JsonConvert.SerializeObject(bodyContent); + //ToDo + var queryContent = ""; // JsonSerializer.Deserialize(bodyContent); var args = GetQuery(req, true); var url = $"{baseDomain}/search/alongRoute/json?subscription-key={Key}&api-version=1.0{args}"; - using (var responseMsg = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post)) - { - using (var data = responseMsg.Content) - { - var content = await data.ReadAsStringAsync(); - var response = Newtonsoft.Json.JsonConvert.DeserializeObject(content); - return Response.CreateResponse(response); - } - } + using var responseMsg = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post); + using var data = responseMsg.Content; + var content = await data.ReadAsStringAsync(); + var response = JsonSerializer.Deserialize(content); + return Response.CreateResponse(response); } catch (AzureMapsException ex) { @@ -978,11 +941,9 @@ public virtual async Task> GetSearchAlongRout var queryContent = GetQuerycontent(queryCollection); - using (var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post)) - { - var resultUrl = responseMessage.Headers.Location.AbsoluteUri; - return (resultUrl, null); - } + using var responseMessage = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post); + var resultUrl = responseMessage.Headers.Location.AbsoluteUri; + return (resultUrl, null); } catch (Exception ex) { @@ -991,32 +952,26 @@ public virtual async Task> GetSearchAlongRout } /// - /// + /// /// /// /// /// - public virtual async Task> GetSearchInsidePolygon(SearchInsidePolygonRequest request, Object geoJson) + public virtual async Task> GetSearchInsidePolygon(SearchInsidePolygonRequest request, GeoCollection geoJson) { try { - var g = new { geometry = geoJson }; - - var json = Newtonsoft.Json.JsonConvert.SerializeObject(g); + string json = "{\"geometry\":" + JsonSerializer.Serialize(geoJson) + "}"; - var args = GetQuery(request, false); + string args = GetQuery(request, false); - var url = $"{baseDomain}/search/geometry/json?subscription-key={Key}&api-version=1.0{args}"; + string url = $"{baseDomain}/search/geometry/json?subscription-key={Key}&api-version=1.0{args}"; - using (var responseMsg = await GetHttpResponseMessage(url, json, HttpMethod.Post)) - { - using (var data = responseMsg.Content) - { - var content = await data.ReadAsStringAsync(); - var response = Newtonsoft.Json.JsonConvert.DeserializeObject(content); - return Response.CreateResponse(response); - } - } + using HttpResponseMessage responseMsg = await GetHttpResponseMessage(url, json, HttpMethod.Post); + using HttpContent data = responseMsg.Content; + string content = await data.ReadAsStringAsync(); + SearchGeometryResponse response = JsonSerializer.Deserialize(content); + return Response.CreateResponse(response); } catch (AzureMapsException ex) { diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs index 85abbf4..c473a7f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs @@ -1,48 +1,43 @@ -using AzureMapsToolkit.GeoJson; -using System; +using System; using System.Collections.Generic; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; +using System.Globalization; using System.Linq; +using System.Net.Http; using System.Net.Http.Headers; -using System.Globalization; -using AzureMapsToolkit.Spatial; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +using Azure.Core.GeoJson; namespace AzureMapsToolkit.Common { public class BaseServices { internal string Key { get; set; } + public BaseServices(string key) { Key = key; } - internal async Task GetHttpResponseMessage(string url, string data, HttpMethod method) + internal static async Task GetHttpResponseMessage(string url, string data, HttpMethod method) { - using (var client = new HttpClient()) - { - client.BaseAddress = new Uri(url); - client.DefaultRequestHeaders.Accept.Clear(); - client.DefaultRequestHeaders.Accept.Add( - new MediaTypeWithQualityHeaderValue("application/json")); - using (var request = new HttpRequestMessage(method, url)) - { - var content = new StringContent(data); //, Encoding.UTF8, "application/json")) + using var client = new HttpClient(); + client.BaseAddress = new Uri(url); + client.DefaultRequestHeaders.Accept.Clear(); + client.DefaultRequestHeaders.Accept.Add( + new MediaTypeWithQualityHeaderValue("application/json")); + using var request = new HttpRequestMessage(method, url); + var content = new StringContent(data); //, Encoding.UTF8, "application/json")) - content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); - request.Content = content; - var response = await client.SendAsync(request); //, HttpCompletionOption.ResponseHeadersRead); + content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + request.Content = content; + var response = await client.SendAsync(request); //, HttpCompletionOption.ResponseHeadersRead); - response.EnsureSuccessStatusCode(); - return response; - } - } + response.EnsureSuccessStatusCode(); + return response; } string _url = string.Empty; @@ -60,18 +55,19 @@ internal string Url } - internal MultiPoint GetMultipPoint(IEnumerable coordinates) + internal static GeoPointCollection GetMultiPoint(IEnumerable coordinates) { - double[,] points = new double[coordinates.Count(), 2]; + List points = new(coordinates.Count()); + + //double[,] points = new double[coordinates.Count(), 2]; for (int i = 0; i < coordinates.Count(); i++) { - points[i, 0] = coordinates.ElementAt(i).Longitude; - points[i, 1] = coordinates.ElementAt(i).Latitude; + GeoPoint point = new(coordinates.ElementAt(i).Longitude, coordinates.ElementAt(i).Latitude); + points.Add(point); } - var multiPoint = new MultiPoint(); - multiPoint.Coordinates = points; - + GeoPointCollection multiPoint = new GeoPointCollection(points); + return multiPoint; } @@ -106,9 +102,9 @@ internal string GetQuery(T request, bool includeApiVersion, bool includeLangu if (propertyInfo?.PropertyType.IsEnum == true || underLayingtype?.IsEnum == true) { - argumentName = Char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name.Substring(1); + argumentName = Char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name[1..]; - argumentValue = propertyInfo.GetValue(request).ToString().Replace(" ", ""); //.ToCamlCase(); + argumentValue = propertyInfo.GetValue(request).ToString().Replace(" ", "").ToCamelCase(); } //else if (propertyInfo != null && propertyInfo.PropertyType.IsArray) //{ @@ -123,15 +119,15 @@ internal string GetQuery(T request, bool includeApiVersion, bool includeLangu else { - var jsonAttribute = propertyInfo.GetCustomAttributes(typeof(JsonPropertyAttribute), false); + var jsonAttribute = propertyInfo.GetCustomAttributes(typeof(JsonPropertyNameAttribute), false); if (jsonAttribute.Length > 0) { - argumentName = ((JsonPropertyAttribute)jsonAttribute[0]).PropertyName; + argumentName = ((JsonPropertyNameAttribute)jsonAttribute[0]).Name; } } if (argumentName == string.Empty) - argumentName = Char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name.Substring(1); + argumentName = Char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name[1..]; if (string.IsNullOrEmpty(argumentValue)) @@ -169,14 +165,12 @@ internal string GetQuery(T request, bool includeApiVersion, bool includeLangu - internal async Task GetByteArray(string baseAddress, string url) + internal static async Task GetByteArray(string baseAddress, string url) { - using (var httpClient = new HttpClient()) - { - httpClient.BaseAddress = new Uri(baseAddress); - var content = await httpClient.GetByteArrayAsync(url); - return content; - } + using var httpClient = new HttpClient(); + httpClient.BaseAddress = new Uri(baseAddress); + var content = await httpClient.GetByteArrayAsync(url); + return content; } internal async Task> ExecuteRequest(string baseUrl, U req) where U : RequestBase @@ -187,12 +181,10 @@ internal async Task> ExecuteRequest(string baseUrl, U req) whe if (req != null) Url += GetQuery(req, true); - using (var client = GetClient(baseUrl)) - { - var data = await GetData(client, Url); - var response = GetResponse(data); - return response; - } + using HttpClient client = GetClient(baseUrl); + T data = await GetData(client, Url); + Response response = GetResponse(data); + return response; } catch (AzureMapsException ex) { @@ -200,25 +192,23 @@ internal async Task> ExecuteRequest(string baseUrl, U req) whe } } - internal string GetQuerycontent(IEnumerable queryCollection) + internal static string GetQuerycontent(IEnumerable queryCollection) { - dynamic q = new JObject(); - q.batchItems = new JArray(); - foreach (var item in queryCollection) + Batch b = new(); + + b.BatchItems = new List(queryCollection.Count()); + foreach (string item in queryCollection) { - dynamic query = new JObject(); - query.query = item; - q.batchItems.Add(query); + BatchItem bi = new (); + bi.Query = item; + b.BatchItems.Add(bi); } - - var queryContent = Newtonsoft.Json.JsonConvert.SerializeObject(q); + string queryContent = JsonSerializer.Serialize(b); return queryContent; } - - - internal HttpClient GetClient(string baseAddress) + internal static HttpClient GetClient(string baseAddress) { var client = new HttpClient(); if (!string.IsNullOrEmpty(baseAddress)) @@ -228,7 +218,7 @@ internal HttpClient GetClient(string baseAddress) return client; } - internal Response GetResponse(T t) + internal static Response GetResponse(T t) { var res = new Response { @@ -237,27 +227,27 @@ internal Response GetResponse(T t) return res; } - internal async Task GetData(HttpClient client, string url) + internal static async Task GetData(HttpClient client, string url) { var res = await client.GetAsync(url); if (res.StatusCode == System.Net.HttpStatusCode.OK) { var json = res.Content.ReadAsStringAsync().Result; - var val = Newtonsoft.Json.JsonConvert.DeserializeObject(json); + var val = JsonSerializer.Deserialize(json); return val; } else { string content = res.Content.ReadAsStringAsync().Result; - var ex = Newtonsoft.Json.JsonConvert.DeserializeObject(content); + var ex = JsonSerializer.Deserialize(content); throw new AzureMapsException(ex); } } - internal string GetUdidFromLocation(string location) + internal static string GetUdidFromLocation(string location) { using (var client = GetClient(location)) { diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Batch.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Batch.cs new file mode 100644 index 0000000..6bacfd3 --- /dev/null +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Batch.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace AzureMapsToolkit.Common +{ + public class Batch + { + [JsonPropertyName("batchItems")] + public List BatchItems { get; set; } + } +} diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BatchItem.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BatchItem.cs new file mode 100644 index 0000000..4810ba0 --- /dev/null +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BatchItem.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace AzureMapsToolkit.Common +{ + public class BatchItem + { + [JsonPropertyName("query")] + public string Query { get; set; } + } +} diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Error.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Error.cs index a6710e1..beabb58 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Error.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Error.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Serialization; namespace AzureMapsToolkit { @@ -12,11 +13,13 @@ public class Error /// /// The HTTP status code. /// + [JsonPropertyName("code")] public string Code { get; set; } /// /// If available, a human readable description of the error. /// + [JsonPropertyName("message")] public string Message { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/ErrorResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/ErrorResponse.cs index 85b3036..5aba2e1 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/ErrorResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/ErrorResponse.cs @@ -1,18 +1,22 @@ using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Serialization; namespace AzureMapsToolkit { - /// - /// This response object is returned when an error occurs in the Maps API - /// +/// +/// This response object is returned when an error occurs in the Maps API +/// public class ErrorResponse { /// /// This object is returned when an error occurs in the Maps API /// + [JsonPropertyName("error")] public Error Error { get; set; } + + } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Extensions.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Extensions.cs index ddae0b6..7f3cf8b 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Extensions.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/Extensions.cs @@ -5,7 +5,7 @@ namespace AzureMapsToolkit.Common { public static class Extensions { - public static string ToCamlCase(this string val) + public static string ToCamelCase(this string val) { char prevChar = val[0]; diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataDetailInfo.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataDetailInfo.cs index f42743a..6b5a46c 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataDetailInfo.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataDetailInfo.cs @@ -1,7 +1,8 @@ -using Newtonsoft.Json; +using System.Text.Json; using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Data { @@ -10,25 +11,25 @@ public class MapDataDetailInfo /// /// The location of the data. Execute a HTTP GET on this location to download the data. /// - [JsonProperty("location")] + [JsonPropertyName("location")] public string Location { get; set; } /// /// The size of the content in bytes. /// - [JsonProperty("sizeInBytes")] + [JsonPropertyName("sizeInBytes")] public int SizeInBytes { get; set; } /// /// The unique data id for the data. /// - [JsonProperty("udid")] + [JsonPropertyName("udid")] public string Udid { get; set; } /// /// The current upload status of the content. /// - [JsonProperty("uploadStatus")] + [JsonPropertyName("uploadStatus")] public string UploadStatus { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataListResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataListResponse.cs index 1cc03d2..1a5373b 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataListResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/MapDataListResponse.cs @@ -1,7 +1,8 @@ -using Newtonsoft.Json; +using System.Text.Json; using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Data { @@ -10,7 +11,7 @@ public class MapDataListResponse /// /// A list of all the previously uploaded data. /// - [JsonProperty("mapDataList")] + [JsonPropertyName("mapDataList")] public List MapDataList { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/UploadResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/UploadResult.cs index 039f6ef..81ebdac 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/UploadResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Data/UploadResult.cs @@ -1,5 +1,6 @@ -using Newtonsoft.Json; +using System.Text.Json; using System; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Data { @@ -8,7 +9,7 @@ public class UploadResult /// /// The unique data id for the data. /// - [JsonProperty("udid")] + [JsonPropertyName("udid")] public Guid Udid { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs index be30bef..c2b928a 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs @@ -1,13 +1,14 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.GeoJson { public class LineString { - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get { return "LineString"; } } - [JsonProperty("coordinates")] + [JsonPropertyName("coordinates")] public double[,] Coordinates { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/MultiPoint.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/MultiPoint.cs index 445db29..0127a44 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/MultiPoint.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/MultiPoint.cs @@ -1,13 +1,14 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.GeoJson { public class MultiPoint { - [JsonProperty("coordinates")] + [JsonPropertyName("coordinates")] public double[,] Coordinates { get; set; } - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get { return "MultiPoint"; } } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/Polygon.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/Polygon.cs index 556f7a6..a162fe3 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/Polygon.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/Polygon.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.GeoJson { @@ -12,7 +13,7 @@ public class Polygon /// /// Specifies the type for the object. Value should always be equal to "Polygon". /// - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get { return "Polygon"; } @@ -29,7 +30,7 @@ public string Type /// /// Coordinates for the Polygon geometry type. /// - [JsonProperty("coordinates")] + [JsonPropertyName("coordinates")] public double[][][] Coordinates { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/CountryRegion.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/CountryRegion.cs index ceba1bc..a703df1 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/CountryRegion.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/CountryRegion.cs @@ -1,4 +1,6 @@ -namespace AzureMapsToolkit.Geolocation +using System.Text.Json.Serialization; + +namespace AzureMapsToolkit.Geolocation { /// /// The object containing the country/region information. @@ -9,6 +11,7 @@ public class CountryRegion /// The IP Address's 2-character code (ISO 3166-1) of the country or /// region as assigned by IANA and regional internet authorities. Please note, IP address in ranges reserved for special purpose will return Null for country/region. /// + [JsonPropertyName("isoCode")] public string IsoCode { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/IpAddressToLocationResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/IpAddressToLocationResult.cs index 9b2be82..c4e7d0d 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/IpAddressToLocationResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Geolocation/IpAddressToLocationResult.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Geolocation { @@ -12,11 +13,13 @@ public class IpAddressToLocationResult /// /// The object containing the country/region information. /// + [JsonPropertyName("countryRegion")] public CountryRegion CountryRegion { get; set; } /// /// The IP Address of the request. /// + [JsonPropertyName("ipAddress")] public string IPAddress { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs index 5727401..da84129 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs @@ -1,4 +1,10 @@ -using AzureMapsToolkit.Common; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +using Azure.Core.GeoJson; + +using AzureMapsToolkit.Common; using AzureMapsToolkit.Data; using AzureMapsToolkit.GeoJson; using AzureMapsToolkit.Mobility; @@ -8,9 +14,6 @@ using AzureMapsToolkit.Spatial; using AzureMapsToolkit.Timezone; using AzureMapsToolkit.Traffic; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; namespace AzureMapsToolkit { @@ -110,7 +113,7 @@ public interface IAzureMapsServices Task<(string ResultUrl, Exception ex)> GetSearchFuzzy(IEnumerable req); - Task> GetSearchInsidePolygon(SearchInsidePolygonRequest request, Object geoJson); + Task> GetSearchInsidePolygon(SearchInsidePolygonRequest request, GeoCollection geoJson); Task> GetTimezoneByCoordinates(TimeZoneRequest req); diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Agency.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Agency.cs index fe844cf..8463518 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Agency.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Agency.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -8,25 +8,25 @@ public class Agency /// /// The Id of the relevant transit agency, for example, '5872' /// - [JsonProperty("agencyId")] + [JsonPropertyName("agencyId")] public string AgencyId { get; set; } /// /// The agency’s GTFS Id. /// - [JsonProperty("agencyKey")] + [JsonPropertyName("agencyKey")] public string AgencyKey { get; set; } /// /// Name of the relevant transit agency, e.g. Metro Transit. /// - [JsonProperty("agencyName")] + [JsonPropertyName("agencyName")] public string AgencyName { get; set; } /// /// Supported public transit type. One of Tram, Subway, Rail, Bus, Ferry, CableCar, Gondola, Funicular. /// - [JsonProperty("transitType")] + [JsonPropertyName("transitType")] public TransitTypeResult TransitType { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Alert.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Alert.cs index 7e029e2..f08bd3c 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Alert.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Alert.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -8,20 +8,20 @@ public class Alert /// /// The level at which the respective alert extents to. One of Metro, Agency, Line, Stop. /// - [JsonProperty("alertLevel")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("alertLevel")] + [JsonConverter(typeof(JsonStringEnumConverter))] public AlertLevel AlertLevel { get; set; } /// /// Text summarizing the alert. /// - [JsonProperty("alertSummary")] + [JsonPropertyName("alertSummary")] public string AlertSummary { get; set; } /// /// The category of the alert. One of None, Regular, Info, Modified, Critical. /// - [JsonProperty("category")] + [JsonPropertyName("category")] public string Category { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Direction.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Direction.cs index 0f5e838..3420ddc 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Direction.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Direction.cs @@ -1,14 +1,14 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { public class Direction { - [JsonConverter(typeof (StringEnumConverter))] + [JsonConverter(typeof (JsonStringEnumConverter))] public AbsoluteDirection AbsoluteDirection { get; set; } - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public RelativeDirection RelativeDirection { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Leg.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Leg.cs index fa273d9..244ad69 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Leg.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Leg.cs @@ -1,6 +1,6 @@ using AzureMapsToolkit.GeoJson; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; using System; namespace AzureMapsToolkit.Mobility @@ -37,7 +37,7 @@ public class Leg /// /// The travel mode of the leg. /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public LegType LegType { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/LineGroup.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/LineGroup.cs index 774b33e..2287fb0 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/LineGroup.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/LineGroup.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -43,7 +43,7 @@ public class LineGroup /// /// The public transit type of the line. /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public TransitType TransitType { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaInfoResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaInfoResponse.cs index ee9b19a..7d001ca 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaInfoResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaInfoResponse.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -7,25 +8,25 @@ public class MetroAreaInfoResponse /// /// Details of the agency. /// - [JsonProperty("agencies")] + [JsonPropertyName("agencies")] public Agency[] Agencies { get; set; } /// /// Basic information associated with the active alert. /// - [JsonProperty("alerts")] + [JsonPropertyName("alerts")] public Alert[] Alerts { get; set; } /// /// The name of the metro area. /// - [JsonProperty("metroName")] + [JsonPropertyName("metroName")] public string MetroName { get; set; } /// /// /// - [JsonProperty("transitTypes")] + [JsonPropertyName("transitTypes")] public TransitTypeResult[] TransitTypes { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaRequest.cs index e3a6b66..e9a17ac 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaRequest.cs @@ -1,4 +1,6 @@ -using AzureMapsToolkit.Common; +using System.Text.Json.Serialization; + +using AzureMapsToolkit.Common; namespace AzureMapsToolkit.Mobility { @@ -7,16 +9,20 @@ public class MetroAreaRequest : RequestBase /// /// The applicable location input. Can be position (specified as a comma separated string composed by latitude followed by longitude e.g. "47.641268,-122.125679") or countryCode (2-character ISO country code). /// + [JsonPropertyName("query")] public string Query { get; set; } + /// /// Language in which search results will be returned. Only NGT is supported. Please refer to Supported languages for details. /// + [JsonPropertyName("language")] public string Language { get; set; } /// /// The type of the query. By default originType=position, specified as a comma separated string composed by latitude followed by longitude, e.g. "47.641268,-122.125679”. /// + [JsonPropertyName("queryType")] public QueryType QueryType { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResponse.cs index 7025169..29992d6 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResponse.cs @@ -1,10 +1,11 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { public class MetroAreaResponse { - [JsonProperty("results")] + [JsonPropertyName("results")] public MetroAreaResult[] Results { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResult.cs index 90455c5..f226908 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/MetroAreaResult.cs @@ -1,4 +1,6 @@ -using AzureMapsToolkit.GeoJson; +using System.Text.Json.Serialization; + +using AzureMapsToolkit.GeoJson; namespace AzureMapsToolkit.Mobility { @@ -7,21 +9,25 @@ public class MetroAreaResult /// /// A valid GeoJSON Polygon geometry type. Please refer to RFC 7946 for details. /// + [JsonPropertyName("geometry")] public Polygon Geometry { get; set; } /// /// The metro area's Id for use with other API calls /// + [JsonPropertyName("metroId")] public int MetroId { get; set; } /// /// The main display name of the metro. /// + [JsonPropertyName("metroName")] public string MetroName { get; set; } /// /// The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. /// + [JsonPropertyName("viewport")] public ResultViewport Viewport { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/RealTimeArrivalResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/RealTimeArrivalResult.cs index 2c3dc99..24a989f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/RealTimeArrivalResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/RealTimeArrivalResult.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -10,13 +11,13 @@ public class RealTimeArrivalResult /// /// The estimated time of arrival in minutes. /// - [JsonProperty("arrivalMinutes")] + [JsonPropertyName("arrivalMinutes")] public int ArrivalMinutes { get; set; } /// /// The public transit type of the line. /// - [JsonProperty("line")] + [JsonPropertyName("line")] public Line Line { get; set; } /// diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/ResultViewport.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/ResultViewport.cs index 34231b9..5c0152a 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/ResultViewport.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/ResultViewport.cs @@ -1,5 +1,6 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -11,13 +12,13 @@ public class ResultViewport /// /// A location represented as a latitude and longitude. /// - [JsonProperty("btmRightPoint")] + [JsonPropertyName("btmRightPoint")] public Coordinate BtmRightPoint { get; set; } /// /// A location represented as a latitude and longitude. /// - [JsonProperty("topLeftPoint")] + [JsonPropertyName("topLeftPoint")] public Coordinate TopLeftPoint { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Stop.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Stop.cs index 9b0291f..3d1529f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Stop.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/Stop.cs @@ -1,6 +1,6 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -22,7 +22,7 @@ public class Stop /// /// The transit type of most lines stopping at this stop. One of Tram, Subway, Rail, Bus, Ferry, CableCar, Gondola, Funicular /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public TransitType MainTransitType { get; set; } /// diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitObjectResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitObjectResult.cs index f90f798..40b60cc 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitObjectResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitObjectResult.cs @@ -1,5 +1,6 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -8,31 +9,31 @@ public class TransitObjectResult /// /// The object identifier found as a result of the query, for example, stopId for stops. /// - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } /// /// The object specific details. /// - [JsonProperty("objectDetails")] + [JsonPropertyName("objectDetails")] public object ObjectDetails { get; set; } /// /// The transit object's position. /// - [JsonProperty("position")] + [JsonPropertyName("position")] public Coordinate Position { get; set; } /// /// The type of object found as a result of the query. /// - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } /// /// The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. /// - [JsonProperty("viewport")] + [JsonPropertyName("viewport")] public ResultViewport Viewport { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitTypeResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitTypeResult.cs index 6243999..8cb306f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitTypeResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Mobility/TransitTypeResult.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Mobility { @@ -8,14 +8,14 @@ public class TransitTypeResult /// /// For metro areas in which local name is different than the GFTS supported transit type, original name is returned. /// - [JsonProperty("captionOverride")] + [JsonPropertyName("captionOverride")] public string CaptionOverride { get; set; } /// /// Supported public transit type. /// - [JsonProperty("transitType")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("transitType")] + [JsonConverter(typeof(JsonStringEnumConverter))] public TransitType TransitType { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightCaptionResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightCaptionResult.cs index 95b9ec8..893f892 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightCaptionResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightCaptionResult.cs @@ -1,7 +1,8 @@ -using Newtonsoft.Json; +using System.Text.Json; using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Render { @@ -13,13 +14,13 @@ public class CopyrightCaptionResult /// /// Copyrights Caption property /// - [JsonProperty("copyrightsCaption")] + [JsonPropertyName("copyrightsCaption")] public string CopyrightsCaption { get; set; } /// /// Format Version property /// - [JsonProperty("formatVersion")] + [JsonPropertyName("formatVersion")] public string FormatVersion { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightTileResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightTileResult.cs index 403b14a..96374dd 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightTileResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/CopyrightTileResult.cs @@ -1,5 +1,6 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Render { /// @@ -10,20 +11,20 @@ public class CopyrightResult /// /// Format Version property /// - [JsonProperty("formatVersion")] + [JsonPropertyName("formatVersion")] public string FormatVersion { get; set; } /// /// General Copyrights array /// - [JsonProperty("generalCopyrights")] + [JsonPropertyName("generalCopyrights")] public string[] GeneralCopyrights { get; set; } /// /// Regions array /// /// - [JsonProperty("regions")] + [JsonPropertyName("regions")] public Region[] Regions { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Country.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Country.cs index 8e861cf..549688b 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Country.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Country.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Render { @@ -15,7 +16,7 @@ public class Country /// /// Label property /// - [JsonProperty("label")] + [JsonPropertyName("label")] public string Label { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Region.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Region.cs index acbd425..3cfe9af 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Region.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Render/Region.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Render { @@ -7,13 +8,13 @@ public class Region /// /// Copyrights array /// - [JsonProperty("copyrights")] + [JsonPropertyName("copyrights")] public string[] Copyrights { get; set; } /// /// Country property /// - [JsonProperty("country")] + [JsonPropertyName("country")] public Country Country { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/Coordinate.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/Coordinate.cs index a89be35..ff02611 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/Coordinate.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/Coordinate.cs @@ -1,5 +1,6 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { /// @@ -10,13 +11,13 @@ public class Coordinate /// /// Latitude property /// - [JsonProperty("latitude")] + [JsonPropertyName("latitude")] public double Latitude { get; set; } /// /// Longitude property /// - [JsonProperty("longitude")] + [JsonPropertyName("longitude")] public double Longitude { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/PostRoutDirectionsRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/PostRoutDirectionsRequest.cs index 4abc67d..ae43b32 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/PostRoutDirectionsRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/PostRoutDirectionsRequest.cs @@ -1,5 +1,5 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json; using System; namespace AzureMapsToolkit.Route diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResponse.cs index 3bb3777..aa17ef9 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResponse.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -11,7 +12,7 @@ public class RouteDirectionsResponse : RouteResponseBase /// /// Routes array /// - [JsonProperty("routes")] + [JsonPropertyName("routes")] public RouteDirectionsResult[] Routes { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResult.cs index 9e07ea4..7057fa2 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsResult.cs @@ -1,5 +1,6 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { public class RouteDirectionsResult @@ -7,25 +8,25 @@ public class RouteDirectionsResult /// /// Contains guidance related elements. This field is present only when guidance was requested and is available. /// - [JsonProperty("guidance")] + [JsonPropertyName("guidance")] public RouteResultGuidance Guidance { get; set; } /// /// Legs array /// - [JsonProperty("legs")] + [JsonPropertyName("legs")] public RouteResultLeg[] Legs { get; set; } /// /// Sections array /// - [JsonProperty("sections")] + [JsonPropertyName("sections")] public RouteResultSection[] Sections { get; set; } /// /// Summary object /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public RouteDirectionsSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsSummary.cs index 8f5a918..97e19b4 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteDirectionsSummary.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -7,31 +8,31 @@ public class RouteDirectionsSummary /// /// Arrival Time property /// - [JsonProperty("arrivalTime")] + [JsonPropertyName("arrivalTime")] public string ArrivalTime { get; set; } /// /// Departure Time property /// - [JsonProperty("departureTime")] + [JsonPropertyName("departureTime")] public string DepartureTime { get; set; } /// /// Length In Meters property /// - [JsonProperty("lengthInMeters")] + [JsonPropertyName("lengthInMeters")] public int LengthInMeters { get; set; } /// /// Traffic Delay In Seconds property /// - [JsonProperty("trafficDelayInSeconds")] + [JsonPropertyName("trafficDelayInSeconds")] public int TrafficDelayInSeconds { get; set; } /// /// Travel Time In Seconds property /// - [JsonProperty("travelTimeInSeconds")] + [JsonPropertyName("travelTimeInSeconds")] public int TravelTimeInSeconds { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrix.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrix.cs index 4a4a854..e1b7a11 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrix.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrix.cs @@ -1,13 +1,14 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { public class RouteMatrix { - [JsonProperty("statusCode")] + [JsonPropertyName("statusCode")] public int StatusCode { get; set; } - [JsonProperty("response")] + [JsonPropertyName("response")] public RouteMatrixRouteSummary Response { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRequest.cs index e6cd3be..d85e3e7 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRequest.cs @@ -1,7 +1,8 @@ -using Newtonsoft.Json; +using System.Text.Json; using System; using System.Collections.Generic; using System.Text; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,26 +11,26 @@ public class RouteMatrixRequest : RouteRequestBase /// /// The date and time of arrival at the destination point. It must be specified as a dateTime. When a time zone offset is not specified it will be assumed to be that of the destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be used in conjunction with departAt, minDeviationDistance or minDeviationTime. /// - [JsonProperty("arriveAt")] + [JsonPropertyName("arriveAt")] public string ArriveAt { get; set; } /// /// Specifies which of the section types is reported in the route response. /// For example if sectionType = pedestrian the sections which are suited for pedestrians only are returned.Multiple types can be used. The default sectionType refers to the travelMode input. By default travelMode is set to car /// - [JsonProperty("sectionType")] + [JsonPropertyName("sectionType")] public SectionType? SectionType { get; set; } /// /// Specifies whether to return additional travel times using different types of traffic information (none, historic, live) as well as the default best-estimate travel time. /// - [JsonProperty("computeTravelTimeFor")] + [JsonPropertyName("computeTravelTimeFor")] public ComputeTravelTimeFor? ComputeTravelTimeFor { get; set; } /// /// Boolean to indicate whether to execute the request asynchronously. If set to true, user will get a 202 response right away. Otherwise, user will get a 202 response only if the request takes longer than 20 seconds to finish. Please refer to the API description for more details on 202 response. /// - [JsonProperty("forceAsync")] + [JsonPropertyName("forceAsync")] public bool? ForceAsync { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponse.cs index 1b2b04c..69f01e7 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponse.cs @@ -1,5 +1,6 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { /// @@ -10,19 +11,19 @@ public class RouteMatrixResponse /// /// Format Version property /// - [JsonProperty("formatVersion")] + [JsonPropertyName("formatVersion")] public string FormatVersion { get; set; } /// /// Results as a 2 dimensional array of route summaries. /// - [JsonProperty("matrix")] + [JsonPropertyName("matrix")] public RouteMatrix[][] Matrix { get; set; } /// /// Summary object /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public RouteMatrixSummary Summary { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponseSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponseSummary.cs index 91a8551..1c6012f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponseSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixResponseSummary.cs @@ -1,22 +1,23 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { public class RouteMatrixResponseSummary { - [JsonProperty("lengthInMeters")] + [JsonPropertyName("lengthInMeters")] public int LengthInMeters { get; set; } - [JsonProperty("travelTimeInSeconds")] + [JsonPropertyName("travelTimeInSeconds")] public int TravelTimeInSeconds { get; set; } - [JsonProperty("trafficDelayInSeconds")] + [JsonPropertyName("trafficDelayInSeconds")] public int TrafficDelayInSeconds { get; set; } - [JsonProperty("departureTime")] + [JsonPropertyName("departureTime")] public string DepartureTime { get; set; } - [JsonProperty("arrivalTime")] - public string arrivalTime { get; set; } + [JsonPropertyName("arrivalTime")] + public string ArrivalTime { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRouteSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRouteSummary.cs index db12561..535e506 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRouteSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixRouteSummary.cs @@ -1,10 +1,11 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { public class RouteMatrixRouteSummary { - [JsonProperty("routeSummary")] + [JsonPropertyName("routeSummary")] public RouteMatrixResponseSummary RouteSummary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixSummary.cs index 7e5c4cb..8ce9a92 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteMatrixSummary.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -7,13 +8,13 @@ public class RouteMatrixSummary /// /// Number of successful routes in the response. /// - [JsonProperty("successfulRoutes ")] + [JsonPropertyName("successfulRoutes ")] public int SuccessfulRoutes { get; set; } /// /// Total number of routes requested. Number of cells in the input matrix. /// - [JsonProperty("totalRoutes")] + [JsonPropertyName("totalRoutes")] public int TotalRoutes { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteOptimizedWaypoint.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteOptimizedWaypoint.cs index e148b1e..8096233 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteOptimizedWaypoint.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteOptimizedWaypoint.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,13 +11,13 @@ public class RouteOptimizedWaypoint /// /// Optimized way point index from the system. /// - [JsonProperty("optimizedIndex")] + [JsonPropertyName("optimizedIndex")] public int OptimizedIndex { get; set; } /// /// Way point index provided by the user. /// - [JsonProperty("providedIndex")] + [JsonPropertyName("providedIndex")] public int ProvidedIndex { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRange.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRange.cs index d9506fa..6b65aff 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRange.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRange.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,14 +11,14 @@ public class RouteRange /// /// Polygon boundary of the reachable range represented as a list of points. /// - [JsonProperty("boundary")] + [JsonPropertyName("boundary")] public Coordinate[] Boundary { get; set; } /// /// Center point of the reachable range /// - [JsonProperty("center")] + [JsonPropertyName("center")] public Coordinate Center { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRangeResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRangeResponse.cs index 39fe177..f1e4f4e 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRangeResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRangeResponse.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -7,7 +8,7 @@ public class RouteRangeResponse: RouteResponseBase /// /// Reachable Range /// - [JsonProperty("reachableRange")] + [JsonPropertyName("reachableRange")] public RouteRange ReachableRange { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRequestBase.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRequestBase.cs index 5058c5e..01a63c8 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRequestBase.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteRequestBase.cs @@ -1,5 +1,5 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json; using System; using System.Collections.Generic; using System.Text; diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseBase.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseBase.cs index 354dfe7..8318b70 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseBase.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseBase.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -7,31 +8,31 @@ public class RouteResponseBase /// /// Copyright property /// - [JsonProperty("copyright")] + [JsonPropertyName("copyright")] public string Copyright { get; set; } /// /// Format Version property /// - [JsonProperty("formatVersion")] + [JsonPropertyName("formatVersion")] public string FormatVersion { get; set; } /// /// Optimized sequence of waypoints. It shows the index from the user provided waypoint sequence for the original and optimized list. For instance, a response: /// - [JsonProperty("optimizedWaypoints")] + [JsonPropertyName("optimizedWaypoints")] public RouteOptimizedWaypoint[] OptimizedWaypoints { get; set; } /// /// Privacy property /// - [JsonProperty("privacy")] + [JsonPropertyName("privacy")] public string Privacy { get; set; } /// /// Reports the effective settings used in the current call. /// - [JsonProperty("report")] + [JsonPropertyName("report")] public RouteResponseReport Report { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReport.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReport.cs index bff4aad..1796591 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReport.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReport.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -11,7 +12,7 @@ public class RouteResponseReport /// /// Effective parameters or data used when calling this Route API. /// - [JsonProperty("effectiveSettings")] + [JsonPropertyName("effectiveSettings")] public RouteResponseReportEffectiveSetting[] EffectiveSettings { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReportEffectiveSetting.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReportEffectiveSetting.cs index 6729c1d..790a2cc 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReportEffectiveSetting.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResponseReportEffectiveSetting.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,13 +11,13 @@ public class RouteResponseReportEffectiveSetting /// /// Name of the parameter used. /// - [JsonProperty("Name of the parameter used.")] + [JsonPropertyName("Name of the parameter used.")] public string Key { get; set; } /// /// Value of the parameter used. /// - [JsonProperty("value")] + [JsonPropertyName("value")] public string Value { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultGuidance.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultGuidance.cs index 56e0b31..742824d 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultGuidance.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultGuidance.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,13 +11,13 @@ public class RouteResultGuidance /// /// Groups a sequence of instruction elements which are related to each other. /// - [JsonProperty("instructionGroups")] + [JsonPropertyName("instructionGroups")] public RouteResultInstructionGroup[] InstructionGroups { get; set; } /// /// A list of instructions describing maneuvers. /// - [JsonProperty("instructions")] + [JsonPropertyName("instructions")] public RouteResultInstruction[] Instructions { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstruction.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstruction.cs index 10d9052..904d3fb 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstruction.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstruction.cs @@ -1,5 +1,5 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -11,64 +11,64 @@ public class RouteResultInstruction /// /// 3-character ISO 3166-1 alpha-3 country code. E.g. USA /// - [JsonProperty("countryCode")] + [JsonPropertyName("countryCode")] public string CountryCode { get; set; } /// /// Indicates left-hand vs. right-hand side driving at the point of the maneuver. /// - [JsonProperty("drivingSide")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("drivingSide")] + [JsonConverter(typeof(JsonStringEnumConverter))] public DrivingSide DrivingSide { get; set; } /// /// Type of the instruction, e.g., turn or change of road form. /// - [JsonProperty("instructionType")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("instructionType")] + [JsonConverter(typeof(JsonStringEnumConverter))] public GuidanceInstructionType instructionType { get; set; } /// /// A code identifying the maneuver. /// - [JsonProperty("maneuver")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("maneuver")] + [JsonConverter(typeof(JsonStringEnumConverter))] public GuidanceManeuver Maneuver { get; set; } /// /// A human-readable message for the maneuver. /// - [JsonProperty("message")] + [JsonPropertyName("message")] public string Message { get; set; } /// /// A location represented as a latitude and longitude. /// - [JsonProperty("point")] + [JsonPropertyName("point")] public Coordinate Point { get; set; } /// /// It is possible to optionally combine the instruction with the next one. This can be used to build messages like "Turn left and then turn right". /// - [JsonProperty("possibleCombineWithNext")] + [JsonPropertyName("possibleCombineWithNext")] public bool PossibleCombineWithNext { get; set; } /// /// Distance from the start of the route to the point of the instruction. /// - [JsonProperty("routeOffsetInMeters")] + [JsonPropertyName("routeOffsetInMeters")] public int RouteOffsetInMeters { get; set; } /// /// Street name of the next significant road segment after the maneuver, or of the street that should be followed. /// - [JsonProperty("street")] + [JsonPropertyName("street")] public string Street { get; set; } /// /// Estimated travel time up to the point corresponding to routeOffsetInMeters. /// - [JsonProperty("travelTimeInSeconds")] + [JsonPropertyName("travelTimeInSeconds")] public int TravelTimeInSeconds { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstructionGroup.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstructionGroup.cs index b2604db..72cfd42 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstructionGroup.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultInstructionGroup.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,25 +11,25 @@ public class RouteResultInstructionGroup /// /// Index of the first instruction. /// - [JsonProperty("firstInstructionIndex")] + [JsonPropertyName("firstInstructionIndex")] public int FirstInstructionIndex { get; set; } /// /// Length of the group /// - [JsonProperty("groupLengthInMeters")] + [JsonPropertyName("groupLengthInMeters")] public int GroupLengthInMeters { get; set; } /// /// Summary message when human-readable text messages are requested for guidance (instructionType=text or tagged). /// - [JsonProperty("groupMessage")] + [JsonPropertyName("groupMessage")] public string groupMessage { get; set; } /// /// Index of the last instruction. /// - [JsonProperty("lastInstructionIndex")] + [JsonPropertyName("lastInstructionIndex")] public int LastInstructionIndex { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLeg.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLeg.cs index bac3640..f1ecc06 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLeg.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLeg.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -7,13 +8,13 @@ public class RouteResultLeg /// /// Points array /// - [JsonProperty("points")] + [JsonPropertyName("points")] public Coordinate[] Points { get; set; } /// /// Summary object for route section. /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public RouteResultLegSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLegSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLegSummary.cs index 233274e..410016e 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLegSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultLegSummary.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -7,61 +8,61 @@ public class RouteResultLegSummary /// /// Arrival Time property /// - [JsonProperty("arrivalTime")] + [JsonPropertyName("arrivalTime")] public string ArrivalTime { get; set; } /// /// Estimated electric energy consumption in kilowatt hours (kWh) using the Electric Consumption Model. Included if vehicleEngineType is set to electric and constantSpeedConsumptionInkWhPerHundredkm is specified. The value of batteryConsumptionInkWh includes the recuperated electric energy and can therefore be negative (which indicates gaining energy). If both maxChargeInkWh and currentChargeInkWh are specified, recuperation will be capped to ensure that the battery charge level never exceeds maxChargeInkWh. If neither maxChargeInkWh nor currentChargeInkWh are specified, unconstrained recuperation is assumed in the consumption calculation. /// - [JsonProperty("batteryConsumptionInkWh")] + [JsonPropertyName("batteryConsumptionInkWh")] public float BatteryConsumptionInkWh { get; set; } /// /// Departure Time property /// - [JsonProperty("departureTime")] + [JsonPropertyName("departureTime")] public string DepartureTime { get; set; } /// /// Estimated fuel consumption in liters using the Combustion Consumption Model. Included if vehicleEngineType is set to combustion and constantSpeedConsumptionInLitersPerHundredkm is specified. The value will be non-negative. /// - [JsonProperty("fuelConsumptionInLiters")] + [JsonPropertyName("fuelConsumptionInLiters")] public float FuelConsumptionInLiters { get; set; } /// /// Estimated travel time calculated using time-dependent historic traffic data. Included only if computeTravelTimeFor = all is used in the query. /// - [JsonProperty("historicTrafficTravelTimeInSeconds")] + [JsonPropertyName("historicTrafficTravelTimeInSeconds")] public int HistoricTrafficTravelTimeInSeconds { get; set; } /// /// Length In Meters property /// - [JsonProperty("lengthInMeters")] + [JsonPropertyName("lengthInMeters")] public int LengthInMeters { get; set; } /// /// Estimated travel time calculated using real-time speed data. Included only if computeTravelTimeFor = all is used in the query. /// - [JsonProperty("liveTrafficIncidentsTravelTimeInSeconds")] + [JsonPropertyName("liveTrafficIncidentsTravelTimeInSeconds")] public int LiveTrafficIncidentsTravelTimeInSeconds { get; set; } /// /// Estimated travel time calculated as if there are no delays on the route due to traffic conditions (e.g. congestion). Included only if computeTravelTimeFor = all is used in the query. /// - [JsonProperty("noTrafficTravelTimeInSeconds")] + [JsonPropertyName("noTrafficTravelTimeInSeconds")] public int NoTrafficTravelTimeInSeconds { get; set; } /// /// Traffic Delay In Seconds property /// - [JsonProperty("trafficDelayInSeconds")] + [JsonPropertyName("trafficDelayInSeconds")] public int TrafficDelayInSeconds { get; set; } /// /// Estimated travel Time In Seconds property /// - [JsonProperty("travelTimeInSeconds")] + [JsonPropertyName("travelTimeInSeconds")] public int TravelTimeInSeconds { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSection.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSection.cs index 3885d86..b17b9cf 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSection.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSection.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -7,55 +8,55 @@ public class RouteResultSection /// /// Delay in seconds caused by the incident. /// - [JsonProperty("delayInSeconds")] + [JsonPropertyName("delayInSeconds")] public int DelayInSeconds { get; set; } /// /// Effective speed of the incident in km/h, averaged over its entire length. /// - [JsonProperty("effectiveSpeedInKmh")] + [JsonPropertyName("effectiveSpeedInKmh")] public int EffectiveSpeedInKmh { get; set; } /// /// End Point Index property /// - [JsonProperty("endPointIndex")] + [JsonPropertyName("endPointIndex")] public int EndPointIndex { get; set; } /// /// The magnitude of delay caused by the incident. These values correspond to the values of the response field of the Get Traffic Incident Detail API. /// - [JsonProperty("magnitudeOfDelay")] + [JsonPropertyName("magnitudeOfDelay")] public MagnitudeOfDelay MagnitudeOfDelay { get; set; } /// /// Section Type property /// - [JsonProperty("sectionType")] + [JsonPropertyName("sectionType")] public string SectionType { get; set; } /// /// Type of the incident. Can currently be JAM, ROAD_WORK, ROAD_CLOSURE, or OTHER. See "tec" for detailed information. /// - [JsonProperty("simpleCategory")] + [JsonPropertyName("simpleCategory")] public string SimpleCategory { get; set; } /// /// Start Point Index property /// - [JsonProperty("startPointIndex")] + [JsonPropertyName("startPointIndex")] public int StartPointIndex { get; set; } /// /// Details of the traffic event, using definitions in the TPEG2-TEC standard. Can contain and elements. /// - [JsonProperty("tec")] + [JsonPropertyName("tec")] public RouteResultSectionTec Tec { get; set; } /// /// Travel Mode property /// - [JsonProperty("travelMode")] + [JsonPropertyName("travelMode")] public string TravelMode { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTec.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTec.cs index 713e18a..8c47315 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTec.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTec.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,13 +11,13 @@ public class RouteResultSectionTec /// /// The effect on the traffic flow. Contains a value in the tec001:EffectCode table, as defined in the TPEG2-TEC standard. Can be used to color-code traffic events according to severity. /// - [JsonProperty("effectCode")] + [JsonPropertyName("effectCode")] public int EffectCode { get; set; } /// /// List of elements. /// - [JsonProperty("causes")] + [JsonPropertyName("causes")] public RouteResultSectionTecCause[] Causes { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTecCause.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTecCause.cs index a1957c7..bdd70cb 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTecCause.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/RouteResultSectionTecCause.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Common { @@ -10,13 +11,13 @@ public class RouteResultSectionTecCause /// /// The main cause of the traffic event. Contains a value in the tec002:CauseCode table, as defined in the TPEG2-TEC standard. /// - [JsonProperty("mainCauseCode")] + [JsonPropertyName("mainCauseCode")] public int MainCauseCode { get; set; } /// /// The subcause of the traffic event. Contains a value in the sub cause table defined by the mainCauseCode, as defined in the TPEG2-TEC standard. /// - [JsonProperty("subCauseCode")] + [JsonPropertyName("subCauseCode")] public int SubCauseCode { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/VehicleEngineType.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/VehicleEngineType.cs index eff0219..2b8b91a 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/VehicleEngineType.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Route/VehicleEngineType.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json; namespace AzureMapsToolkit.Common { diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/CoordinateAbbreviated.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/CoordinateAbbreviated.cs index 87a1c8d..43adb39 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/CoordinateAbbreviated.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/CoordinateAbbreviated.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,13 +10,13 @@ public class CoordinateAbbreviated /// /// Latitude property /// - [JsonProperty("lat")] + [JsonPropertyName("lat")] public double Lat { get; set; } /// /// Longitude property /// - [JsonProperty("lon")] + [JsonPropertyName("lon")] public double Lon { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSources.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSources.cs index d946e8d..a22566e 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSources.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSources.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,7 +7,7 @@ public class DataSources /// /// Information about the geometric shape of the result. Only present if type == Geography. /// - [JsonProperty("geometry")] + [JsonPropertyName("geometry")] public DataSourcesGeometry Geometry { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSourcesGeometry.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSourcesGeometry.cs index b325cc8..2d55e09 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSourcesGeometry.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/DataSourcesGeometry.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,7 +10,7 @@ public class DataSourcesGeometry /// /// Information about the geometric shape of the result. Only present if type == Geography. /// - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressEntityTypes.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressEntityType.cs similarity index 64% rename from AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressEntityTypes.cs rename to AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressEntityType.cs index 6a32e0c..277f028 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressEntityTypes.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressEntityType.cs @@ -6,10 +6,14 @@ namespace AzureMapsToolkit.Search { /// - /// Specifies the level of filtering performed on geographies. Narrows the search for specified geography entity types, e.g. return only municipality. The resulting response will contain the geography ID as well as the entity type matched. If you provide more than one entity as a comma separated list, endpoint will return the 'smallest entity available'. Returned Geometry ID can be used to get the geometry of that geography via Get Search Polygon API. The following parameters are ignored when entityType is set: + /// Specifies the level of filtering performed on geographies. Narrows the search for specified geography entity types, e.g. return only municipality. + /// The resulting response will contain the geography ID as well as the entity type matched. If you provide more than one entity as a comma separated list, + /// endpoint will return the 'smallest entity available'. Returned Geometry ID can be used to get the geometry of that geography via Get Search Polygon API. + /// The following parameters are ignored when entityType is set: + /// heading, number, returnRoadUse, returnSpeedLimit, roadUse, returnMatchType /// [Flags] - public enum SearchAddressEntityTypes: byte + public enum SearchAddressEntityType: byte { [NameArgument("Country")] Country = 1 << 0, diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResponse.cs index c51b350..60097d6 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,14 +10,14 @@ public class SearchAddressResponse /// /// Results array /// - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchAddressResult[] Results { get; set; } /// /// Summary object for a Search Address response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResult.cs index 7e80642..7affca8 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search @@ -9,37 +9,37 @@ public class SearchAddressResult /// /// The address of the result /// - [JsonProperty("address")] + [JsonPropertyName("address")] public SearchResultAddress Address { get; set; } /// /// Optional section. Reference ids for use with the Get Search Polygon API. /// - [JsonProperty("dataSources")] + [JsonPropertyName("dataSources")] public DataSources DataSources { get; set; } /// /// Entry Points array /// - [JsonProperty("entryPoints")] + [JsonPropertyName("entryPoints")] public SearchResultEntryPoint[] EntryPoints { get; set; } /// /// Id property /// - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } /// /// A location represented as a latitude and longitude. /// - [JsonProperty("position")] + [JsonPropertyName("position")] public CoordinateAbbreviated Position { get; set; } /// /// The value within a result set to indicate the relative matching score between results. You can use this to determine that result x is twice as likely to be as relevant as result y if the value of x is 2x the value of y. The values vary between queries and is only meant as a relative value for one result set. /// - [JsonProperty("score")] + [JsonPropertyName("score")] public double Score { get; set; } /// @@ -51,16 +51,16 @@ public class SearchAddressResult /// Address Range, /// Cross Street /// - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } /// /// The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. /// - [JsonProperty("viewport")] + [JsonPropertyName("viewport")] public SearchResultViewport Viewport { get; set; } - [JsonProperty("dist")] + [JsonPropertyName("dist")] public decimal Dist { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetRequest.cs index 4c69a16..1029d95 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetRequest.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetResponse.cs index c23ce73..fe88846 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseCrossStreetResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,13 +7,13 @@ public class SearchAddressReverseCrossStreetResponse /// /// Addresses array /// - [JsonProperty("addresses")] + [JsonPropertyName("addresses")] public SearchAddressReverseResult[] Addresses { get; set; } /// /// Summary object for a Search Address Reverse Cross Street response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchAddressReverseSummary Summary { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseRequest.cs index abc1dd1..bd4701a 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseRequest.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -66,7 +66,7 @@ public class SearchAddressReverseRequest : SearchRequestBase /// - roadUse /// - returnMatchType /// - public SearchAddressEntityTypes? EntityType { get; set; } + public SearchAddressEntityType? EntityType { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResponse.cs index 051bd93..0f9fd53 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,13 +7,13 @@ public class SearchAddressReverseResponse /// /// Addresses array /// - [JsonProperty("addresses")] + [JsonPropertyName("addresses")] public SearchAddressReverseResult[] Addresses { get; set; } /// /// Summary object for a Search Address Reverse response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchAddressReverseSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResult.cs index 3c193ab..536a47c 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,13 +7,13 @@ public class SearchAddressReverseResult /// /// The address of the result /// - [JsonProperty("address")] + [JsonPropertyName("address")] public SearchResultAddress Address { get; set; } /// /// Position property in the form of "{latitude},{longitude}" /// - [JsonProperty("position")] + [JsonPropertyName("position")] public string Position { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseSummary.cs index 2b4d82e..5604932 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressReverseSummary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -10,13 +10,13 @@ public class SearchAddressReverseSummary /// /// NumResults property /// - [JsonProperty("numResults")] + [JsonPropertyName("numResults")] public int NumResults { get; set; } /// /// QueryTime property /// - [JsonProperty("queryTime")] + [JsonPropertyName("queryTime")] public int QueryTime { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResponse.cs index d6cbb3e..f17d4bf 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,13 +7,13 @@ public class SearchAddressStructuredResponse /// /// Results array /// - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchAddressStructuredResult[] Results { get; set; } /// /// Summary object for a Search Address Structured response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchAddressStructuredSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResult.cs index 6a1b53c..10ee8f3 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -8,19 +8,19 @@ public class SearchAddressStructuredResult : SearchResult /// /// Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. /// - [JsonProperty("addressRanges")] + [JsonPropertyName("addressRanges")] public SearchResultAddressRanges AddressRanges { get; set; } /// /// Straight line distance between the result and geobias location in meters. /// - [JsonProperty("dist")] + [JsonPropertyName("dist")] public double Dist { get; set; } /// /// Info property /// - [JsonProperty("info")] + [JsonPropertyName("info")] public string Info { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredSummary.cs index 4aa3eb5..4b1965c 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAddressStructuredSummary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -12,13 +12,13 @@ public class SearchAddressStructuredSummary : SearchSummary /// /// Indication when the internal search engine has applied a geospatial bias to improve the ranking of results. In some methods, this can be affected by setting the lat and lon parameters where available. In other cases it is purely internal. /// - [JsonProperty("geoBias")] + [JsonPropertyName("geoBias")] public SearchSummaryGeoBias GeoBias { get; set; } /// /// Maximum number of responses that will be returned /// - [JsonProperty("limit")] + [JsonPropertyName("limit")] public int Limit { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResponse.cs index 5875ae0..096b357 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,14 +10,14 @@ public class SearchAlongRouteResponse /// /// A list of Search Along Route results. /// - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchAlongRouteResult[] Results { get; set; } /// /// Summary object for a Search Along Route response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResult.cs index 629abbb..b2b3025 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchAlongRouteResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,14 +7,14 @@ public class SearchAlongRouteResult : SearchNearbyPoiResult /// /// Detour time in seconds /// - [JsonProperty("detourTime")] + [JsonPropertyName("detourTime")] public int DetourTime { get; set; } /// /// Entity Type property /// - [JsonProperty("entityType")] + [JsonPropertyName("entityType")] public string EntityType { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyRequest.cs index dc9b348..5db3c72 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyRequest.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResponse.cs index d8c7bb2..eb946e0 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,14 +7,14 @@ public class SearchFuzzyResponse /// /// Results array /// - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchFuzzyResult[] Results { get; set; } /// /// Summary object for a Search Fuzzy response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResult.cs index 9a4cdd7..8ccdcf8 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchFuzzyResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { public class SearchFuzzyResult : SearchResult @@ -6,7 +6,7 @@ public class SearchFuzzyResult : SearchResult /// /// The address of the result /// - [JsonProperty("adress")] + [JsonPropertyName("adress")] public SearchResultAddress[] Addresses { get; set; } //hack for hiding @@ -15,14 +15,14 @@ public class SearchFuzzyResult : SearchResult /// /// Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. /// - [JsonProperty("addressRanges")] + [JsonPropertyName("addressRanges")] public SearchResultAddressRanges AddressRanges { get; set; } /// /// Optional section. Reference ids for use with the Get Search Polygon API. /// - [JsonProperty("dataSources")] + [JsonPropertyName("dataSources")] public DataSources DataSources { get; set; } /// @@ -36,7 +36,7 @@ public class SearchFuzzyResult : SearchResult /// - Neighbourhood /// - PostalCodeArea /// - [JsonProperty("entityType")] + [JsonPropertyName("entityType")] public string EntityType { get; set; } @@ -44,7 +44,7 @@ public class SearchFuzzyResult : SearchResult /// /// Info property /// - [JsonProperty("info")] + [JsonPropertyName("info")] public string Info { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResponse.cs index ded18b5..5665e7e 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,13 +10,13 @@ public class SearchGeometryResponse /// /// A list of Search Inside Geometry results. /// - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchGeometryResult[] Results { get; set; } /// /// Summary object for a Search Geometry response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResult.cs index 861a366..5c974f3 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchGeometryResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -11,13 +11,13 @@ public class SearchGeometryResult : SearchResult /// /// Entity Type property /// - [JsonProperty("entityTyp")] + [JsonPropertyName("entityTyp")] public string EntityType { get; set; } /// /// Info property /// - [JsonProperty("info")] + [JsonPropertyName("info")] public string Info { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyPoiResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyPoiResult.cs index a86ed33..9c9da07 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyPoiResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyPoiResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -9,13 +9,13 @@ public class SearchNearbyPoiResult : SearchResult /// /// Straight line distance between the result and geobias location in meters. /// - [JsonProperty("dist")] + [JsonPropertyName("dist")] public double Distance { get; set; } /// /// Info property /// - [JsonProperty("info")] + [JsonPropertyName("info")] public string Info { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyRequest.cs index f2bde19..0e886bc 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyRequest.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,7 +7,7 @@ public class SearchNearbyRequest : SearchRequestBaseExtended /// /// Latitude where results should be biased. E.g. 37.337. /// - [JsonProperty("lat")] + [JsonPropertyName("lat")] public double Lat { get; set; } @@ -15,19 +15,19 @@ public double Lat /// /// Longitude where results should be biased. E.g. -121.89. /// - [JsonProperty("lon")] + [JsonPropertyName("lon")] public double Lon { get; set; } /// /// Comma separated string of country codes, e.g. FR, ES. This will limit the search to the specified countries /// - [JsonProperty("countrySet")] + [JsonPropertyName("countrySet")] public string CountrySet { get; set; } /// /// The radius in meters to for the results to be constrained to the defined area, Min value is 1, Max Value is 50000. /// - [JsonProperty("radius")] + [JsonPropertyName("radius")] public double? Radius { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyResponse.cs index 4d2719b..10af635 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbyResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,13 +7,13 @@ public class SearchNearbyResponse /// /// Results array /// - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchNearbyPoiResult[] Results { get; set; } /// /// Summary object for a Search Nearby response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchNearbySummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbySummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbySummary.cs index b956619..d4ffd11 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbySummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchNearbySummary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,7 +7,7 @@ public class SearchNearbySummary : SearchSummary /// /// Indication when the internal search engine has applied a geospatial bias to improve the ranking of results. In some methods, this can be affected by setting the lat and lon parameters where available. In other cases it is purely internal. /// - [JsonProperty("geoBias")] + [JsonPropertyName("geoBias")] public SearchSummaryGeoBias GeoBias { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiCategoryResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiCategoryResponse.cs index dcc4059..01879ac 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiCategoryResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiCategoryResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,13 +10,13 @@ public class SearchPoiCategoryResponse /// /// Results array /// - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchNearbyPoiResult[] Results { get; set; } /// /// Summary object for a Search POI Category response /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiResponse.cs index b9147e0..9defb2f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchPoiResponse.cs @@ -1,17 +1,17 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { public class SearchPoiResponse { - [JsonProperty("results")] + [JsonPropertyName("results")] public SearchNearbyPoiResult[] Results { get; set; } /// /// /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public SearchSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBase.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBase.cs index 5b0dbbd..3659929 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBase.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBase.cs @@ -1,5 +1,5 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBaseExtended.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBaseExtended.cs index dca8ed0..7c8c080 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBaseExtended.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchRequestBaseExtended.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -21,19 +21,19 @@ public class SearchRequestBaseExtended : SearchRequestBase /// -extendedPostalCodesFor = None /// Extended postal code is returned as an extendedPostalCode property of an address. Availability is region-dependent. /// - [JsonProperty("extendedPostalCodesFor")] + [JsonPropertyName("extendedPostalCodesFor")] public string ExtendedPostalCodesFor { get; set; } /// /// Starting offset of the returned results within the full result set /// - [JsonProperty("ofs")] + [JsonPropertyName("ofs")] public int? Offset { get; set; } /// /// Maximum number of responses that will be returned /// - [JsonProperty("limit")] + [JsonPropertyName("limit")] public int? Limit { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResult.cs index f469fad..c828775 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,20 +7,20 @@ public class SearchResult /// /// The address of the result /// - [JsonProperty("address")] + [JsonPropertyName("address")] public SearchResultAddress Address { get; set; } /// /// Entry Points array /// - [JsonProperty("entryPoints")] + [JsonPropertyName("entryPoints")] public SearchResultEntryPoint[] EntryPoints { get; set; } /// /// Id property /// - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } @@ -28,33 +28,33 @@ public class SearchResult /// /// Details of the poi including the name, phone, url, and categories. /// - [JsonProperty("poi")] + [JsonPropertyName("poi")] public SearchResultPoi Poi { get; set; } /// /// A location represented as a latitude and longitude. /// - [JsonProperty("position")] + [JsonPropertyName("position")] public CoordinateAbbreviated Position { get; set; } /// /// The value within a result set to indicate the relative matching score between results. You can use this to determine that result x is twice as likely to be as relevant as result y if the value of x is 2x the value of y. The values vary between queries and is only meant as a relative value for one result set. /// - [JsonProperty("score")] + [JsonPropertyName("score")] public double Score { get; set; } /// /// Type property /// - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } /// /// The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. /// - [JsonProperty("viewport")] + [JsonPropertyName("viewport")] public SearchResultViewport Viewport { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddress.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddress.cs index cb27dc7..e6c7b03 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddress.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddress.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,115 +10,115 @@ public class SearchResultAddress /// /// Building Number property /// - [JsonProperty("buildingNumber")] + [JsonPropertyName("buildingNumber")] public string BuildingNumber { get; set; } /// /// Country property /// - [JsonProperty("country")] + [JsonPropertyName("country")] public string Country { get; set; } /// /// Country Code property /// - [JsonProperty("countryCode")] + [JsonPropertyName("countryCode")] public string CountryCode { get; set; } /// /// Country Code ISO3 property /// - [JsonProperty("countryCodeISO3")] + [JsonPropertyName("countryCodeISO3")] public string CountryCodeISO3 { get; set; } /// /// Country Secondary Subdivision property /// - [JsonProperty("countrySecondarySubdivision")] + [JsonPropertyName("countrySecondarySubdivision")] public string CountrySecondarySubdivision { get; set; } /// /// Country Subdivision property /// - [JsonProperty("countrySubdivision")] + [JsonPropertyName("countrySubdivision")] public string CountrySubdivision { get; set; } /// /// Country Subdividion Name property /// - [JsonProperty("countrySubdivisionName")] + [JsonPropertyName("countrySubdivisionName")] public string CountrySubdivisionName { get; set; } /// /// Country Tertiary Subdivision property /// - [JsonProperty("countryTertiarySubdivision")] + [JsonPropertyName("countryTertiarySubdivision")] public string CountryTertiarySubdivision { get; set; } /// /// Cross Street property /// - [JsonProperty("crossStreet ")] + [JsonPropertyName("crossStreet ")] public string CrossStreet { get; set; } /// /// Extended Postal Code property /// - [JsonProperty("extendedPostalCode")] + [JsonPropertyName("extendedPostalCode")] public string ExtendedPostalCode { get; set; } /// /// Free form Address property /// - [JsonProperty("freeformAddress")] + [JsonPropertyName("freeformAddress")] public string FreeformAddress { get; set; } /// /// Municipality property /// - [JsonProperty("municipality")] + [JsonPropertyName("municipality")] public string Municipality { get; set; } /// /// Municipality Subdivision property /// - [JsonProperty("municipalitySubdivision")] + [JsonPropertyName("municipalitySubdivision")] public string MunicipalitySubdivision { get; set; } /// /// Postal Code property /// - [JsonProperty("postalCode")] + [JsonPropertyName("postalCode")] public string PostalCode { get; set; } /// /// number of routes /// - [JsonProperty("routeNumbers")] + [JsonPropertyName("routeNumbers")] public string[] RouteNumbers { get; set; } /// /// Street property /// - [JsonProperty("street")] + [JsonPropertyName("street")] public string Street { get; set; } /// /// Street Name property /// - [JsonProperty("streetName")] + [JsonPropertyName("streetName")] public string StreetName { get; set; } /// /// Street Name and Number property /// - [JsonProperty("streetNameAndNumber")] + [JsonPropertyName("streetNameAndNumber")] public string StreetNameAndNumber { get; set; } /// /// Street Number property /// - [JsonProperty("streetNumber")] + [JsonPropertyName("streetNumber")] public string StreetNumber { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddressRanges.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddressRanges.cs index 48d7fda..55b6007 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddressRanges.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultAddressRanges.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { public class SearchResultAddressRanges @@ -7,21 +7,21 @@ public class SearchResultAddressRanges /// /// A location represented as a latitude and longitude. /// - [JsonProperty("from")] + [JsonPropertyName("from")] public CoordinateAbbreviated From { get; set; } - [JsonProperty("rangeLeft")] + [JsonPropertyName("rangeLeft")] public string RangeLeft { get; set; } - [JsonProperty("rangeRight")] + [JsonPropertyName("rangeRight")] public string RangeRight { get; set; } /// /// A location represented as a latitude and longitude. /// - [JsonProperty("to")] + [JsonPropertyName("to")] public CoordinateAbbreviated To { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultEntryPoint.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultEntryPoint.cs index c81bcd2..3077268 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultEntryPoint.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultEntryPoint.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,14 +10,14 @@ public class SearchResultEntryPoint /// /// A location represented as a latitude and longitude. /// - [JsonProperty("position")] + [JsonPropertyName("position")] public CoordinateAbbreviated Position { get; set; } /// /// The type of entry point. Value can be either main or minor. /// - [JsonProperty("type")] + [JsonPropertyName("type")] public string Type { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoi.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoi.cs index 2300837..c0f39d3 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoi.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoi.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { public class SearchResultPoi @@ -6,31 +6,31 @@ public class SearchResultPoi /// /// Categories array /// - [JsonProperty("categories")] + [JsonPropertyName("categories")] public string[] Categories { get; set; } /// /// Classification array /// - [JsonProperty("classifications")] + [JsonPropertyName("classifications")] public SearchResultPoiClassification[] Classifications { get; set; } /// /// Name property /// - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } /// /// Phone property /// - [JsonProperty("phone")] + [JsonPropertyName("phone")] public string Phone { get; set; } /// /// URL property /// - [JsonProperty("url")] + [JsonPropertyName("url")] public string Url { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassification.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassification.cs index eccc94e..da5eeff 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassification.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassification.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { public class SearchResultPoiClassification @@ -7,14 +7,14 @@ public class SearchResultPoiClassification /// /// Code property /// - [JsonProperty("code")] + [JsonPropertyName("code")] public string Code { get; set; } /// /// Names array /// - [JsonProperty("names")] + [JsonPropertyName("names")] public SearchResultPoiClassificationName[] Names { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassificationName.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassificationName.cs index c36ddc8..5e36d21 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassificationName.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultPoiClassificationName.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { public class SearchResultPoiClassificationName @@ -6,14 +6,14 @@ public class SearchResultPoiClassificationName /// /// Name property /// - [JsonProperty("name")] + [JsonPropertyName("name")] public string Name { get; set; } /// /// Name Locale property /// - [JsonProperty("nameLocale")] + [JsonPropertyName("nameLocale")] public string NameLocale { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultViewport.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultViewport.cs index 7771c6d..9cf8510 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultViewport.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchResultViewport.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -10,13 +10,13 @@ public class SearchResultViewport /// /// A location represented as a latitude and longitude. /// - [JsonProperty("btmRightPoint")] + [JsonPropertyName("btmRightPoint")] public CoordinateAbbreviated BtmRightPoint { get; set; } /// /// A location represented as a latitude and longitude. /// - [JsonProperty("topLeftPoint")] + [JsonPropertyName("topLeftPoint")] public CoordinateAbbreviated TopLeftPoint { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummary.cs index 6c12322..6d3b85b 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { @@ -7,43 +7,43 @@ public class SearchSummary /// /// FuzzyLevel property /// - [JsonProperty("fuzzyLevel")] + [JsonPropertyName("fuzzyLevel")] public int FuzzyLevel { get; set; } /// /// NumResults property /// - [JsonProperty("numResults")] + [JsonPropertyName("numResults")] public int NumResults { get; set; } /// /// Offset property /// - [JsonProperty("offset")] + [JsonPropertyName("offset")] public int Offset { get; set; } /// /// Query property /// - [JsonProperty("query")] + [JsonPropertyName("query")] public string Query { get; set; } /// /// QueryTime property /// - [JsonProperty("queryTime")] + [JsonPropertyName("queryTime")] public int QueryTime { get; set; } /// /// QueryType property /// - [JsonProperty("queryType")] + [JsonPropertyName("queryType")] public string QueryType { get; set; } /// /// TotalResults property /// - [JsonProperty("totalResults")] + [JsonPropertyName("totalResults")] public int TotalResults { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummaryGeoBias.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummaryGeoBias.cs index 00a730e..d480fba 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummaryGeoBias.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Search/SearchSummaryGeoBias.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Search { diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs index 3c7f0af..022ef4e 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -10,19 +10,19 @@ public class ClosestPointResultEntry /// /// The distance in meters from the source point to the closest point /// - [JsonProperty("distanceInMeters")] + [JsonPropertyName("distanceInMeters")] public double DistanceInMeters { get; set; } /// /// The unique id identifies a geometry /// - [JsonProperty("geometryId")] + [JsonPropertyName("geometryId")] public int GeometryId { get; set; } /// /// A location represented as a latitude and longitude /// - [JsonProperty("position")] + [JsonPropertyName("position")] public Coordinate Position { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointSummary.cs index 73cd8bf..3eec3a5 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointSummary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -10,19 +10,19 @@ public class ClosestPointSummary /// /// Processing information /// - [JsonProperty("information")] + [JsonPropertyName("information")] public string Information { get; set; } /// /// A location represented as a latitude and longitude /// - [JsonProperty("sourcePoint")] + [JsonPropertyName("sourcePoint")] public Coordinate SourcePoint { get; set; } /// /// A unique data id (udid) for the uploaded content /// - [JsonProperty("udid")] + [JsonPropertyName("udid")] public string Udid { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Coordinate.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Coordinate.cs index 8d5cf60..063c843 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Coordinate.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Coordinate.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -10,13 +10,13 @@ public class Coordinate /// /// Latitude property /// - [JsonProperty("lat")] + [JsonPropertyName("lat")] public double Lat { get; set; } /// /// Longitude property /// - [JsonProperty("lon")] + [JsonPropertyName("lon")] public double Lon { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GeofenceGeometry.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GeofenceGeometry.cs index 9827125..5374280 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GeofenceGeometry.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GeofenceGeometry.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -7,38 +7,38 @@ public class GeofenceGeometry /// /// ID of the device. /// - [JsonProperty("deviceId")] + [JsonPropertyName("deviceId")] public string deviceId { get; set; } /// /// Distance from the coordinate to the closest border of the geofence. Positive means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, but more than the value of searchBuffer away from the closest geofence border, then the value is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside the polygon, but more than the value of searchBuffer away from the closest geofencing border, then the value is -999. A value of 999 means that there is great confidence the coordinate is well outside the geofence. A value of -999 means that there is great confidence the coordinate is well within the geofence. /// - [JsonProperty("distance")] + [JsonPropertyName("distance")] public double Distance { get; set; } /// /// The unique id identifies a geometry. /// - [JsonProperty("geometryId")] + [JsonPropertyName("geometryId")] public string GeometryId { get; set; } /// /// Latitude of the nearest point of the geometry. /// - [JsonProperty("nearestLat")] + [JsonPropertyName("nearestLat")] public double NearestLat { get; set; } /// /// Longitude of the nearest point of the geometry. /// - [JsonProperty("nearestLon")] + [JsonPropertyName("nearestLon")] public double nearestLon { get; set; } /// /// The unique id returned from Data Upload API after uploading a valid GeoJSON FeatureCollection object. Please refer to RFC 7946 for details. All the feature's properties should contain geometryId, which is used for identifying the geometry and is case-sensitive. /// - [JsonProperty("udId")] + [JsonPropertyName("udId")] public string UdId { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetBufferResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetBufferResponse.cs index 50d3ba7..b398dc0 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetBufferResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetBufferResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -7,13 +7,13 @@ namespace AzureMapsToolkit.Spatial { public class BufferResponse { - [JsonProperty("result")] + [JsonPropertyName("result")] public object Result { get; set; } - [JsonProperty("results")] + [JsonPropertyName("results")] public object Results { get; set; } - [JsonProperty("summary")] + [JsonPropertyName("summary")] public Summary Summary { get; set; } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetClosestPointResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetClosestPointResponse.cs index efcb5d0..f278282 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetClosestPointResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetClosestPointResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -14,14 +14,14 @@ public class ClosestPointResponse /// Closest Point Result Array /// /// - [JsonProperty("result")] + [JsonPropertyName("result")] public ClosestPointResultEntry[] Result { get; set; } /// /// Get Closest Point Summary object /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public ClosestPointSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetGeofenceResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetGeofenceResponse.cs index b9ee190..6238712 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetGeofenceResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetGeofenceResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -10,25 +10,25 @@ public class GeofenceResponse /// /// Lists of the geometry ID of the geofence which is expired relative to the user time in the request. /// - [JsonProperty("expiredGeofenceGeometryId")] + [JsonPropertyName("expiredGeofenceGeometryId")] public string[] ExpiredGeofenceGeometryId { get; set; } /// /// Lists the fence geometries that contain the coordinate position or overlap the searchBuffer around the position. /// - [JsonProperty("geometries")] + [JsonPropertyName("geometries")] public GeofenceGeometry[] Geometries { get; set; } /// /// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. /// - [JsonProperty("InvalidPeriodGeofenceGeometryId")] + [JsonPropertyName("InvalidPeriodGeofenceGeometryId")] public string[] InvalidPeriodGeofenceGeometryId { get; set; } /// /// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure Maps event subscriber. /// - [JsonProperty("isEventPublished")] + [JsonPropertyName("isEventPublished")] public bool IsEventPublished { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetPointInPolygonSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetPointInPolygonSummary.cs index 95a6b96..d93d10f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetPointInPolygonSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GetPointInPolygonSummary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -7,20 +7,20 @@ public class GetPointInPolygonSummary /// /// Processing information /// - [JsonProperty("information")] + [JsonPropertyName("information")] public string Information { get; set; } /// /// A location represented as a latitude and longitude /// - [JsonProperty("sourcePoint")] + [JsonPropertyName("sourcePoint")] public Coordinate SourcePoint { get; set; } /// /// A unique data id (udid) for the uploaded content /// - [JsonProperty("udid")] + [JsonPropertyName("udid")] public string Udid { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GreatCircleDistanceResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GreatCircleDistanceResponse.cs index 330ed5d..548677d 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GreatCircleDistanceResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/GreatCircleDistanceResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -7,13 +7,13 @@ public class GreatCircleDistanceResponse : SpatialRequestBase /// /// Result Object /// - [JsonProperty("result")] + [JsonPropertyName("result")] public Result Result { get; set; } /// /// Summary object /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public Summary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResponse.cs index aa2c66e..878a371 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -10,13 +10,13 @@ public class PointInPolygonResponse /// /// Point In Polygon Result Object /// - [JsonProperty("result")] + [JsonPropertyName("result")] public PointInPolygonResult Result { get; set; } /// /// Point In Polygon Summary object /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public GetPointInPolygonSummary Summary { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResult.cs index 77ad9a0..49abc3b 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PointInPolygonResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -7,13 +7,13 @@ public class PointInPolygonResult /// /// Geometries array /// - [JsonProperty("intersectingGeometries")] + [JsonPropertyName("intersectingGeometries")] public string[] IntersectingGeometries { get; set; } /// /// Point In Polygons Property /// - [JsonProperty("pointInPolygons")] + [JsonPropertyName("pointInPolygons")] public bool PointInPolygons { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonResponse.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonResponse.cs index cd48278..02f2b7f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonResponse.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonResponse.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -7,13 +7,13 @@ public class PostPointInPolygonResponse /// /// Point In Polygon Result Object /// - [JsonProperty("result")] + [JsonPropertyName("result")] public PointInPolygonResult Result { get; set; } /// /// Point In Polygon Summary object /// - [JsonProperty("summary")] + [JsonPropertyName("summary")] public PostPointInPolygonSummary Summary { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonSummary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonSummary.cs index a48d6ec..87927ae 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonSummary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/PostPointInPolygonSummary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -10,13 +10,13 @@ public class PostPointInPolygonSummary /// /// Processing information /// - [JsonProperty("information")] + [JsonPropertyName("information")] public string Information { get; set; } /// /// A location represented as a latitude and longitude /// - [JsonProperty("sourcePoint")] + [JsonPropertyName("sourcePoint")] public Coordinate SourcePoint { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Result.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Result.cs index bb00165..a278910 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Result.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Result.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -7,7 +7,7 @@ public class Result /// /// The great circle distance in meters from the source point to the target point /// - [JsonProperty("distanceInMeters")] + [JsonPropertyName("distanceInMeters")] public double DistanceInMeters { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Summary.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Summary.cs index 244c35f..01ae581 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Summary.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/Summary.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Spatial { @@ -10,13 +10,13 @@ public class Summary /// /// The information about what happened during the call. /// - [JsonProperty("information")] + [JsonPropertyName("information")] public string Information { get; set; } /// /// The udid for the user data if one exists /// - [JsonProperty("udid")] + [JsonPropertyName("udid")] public string Udid { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/IanaId.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/IanaId.cs index b72ff0c..64b759a 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/IanaId.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/IanaId.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Timezone { @@ -7,26 +7,26 @@ public class IanaId /// /// AliasOf property /// - [JsonProperty("aliasOf")] + [JsonPropertyName("aliasOf")] public string AliasOf { get; set; } /// /// HasZone1970Location property /// - [JsonProperty("hasZone1970Location")] + [JsonPropertyName("hasZone1970Location")] public bool HasZone1970Location { get; set; } /// /// Id property /// - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } /// /// IsAlias property /// - [JsonProperty("isAlias")] + [JsonPropertyName("isAlias")] public bool IsAlias { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneIanaVersionResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneIanaVersionResult.cs index 73e7f58..6062bc5 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneIanaVersionResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneIanaVersionResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Timezone { @@ -10,7 +10,7 @@ public class TimezoneIanaVersionResult /// /// Version property /// - [JsonProperty("version")] + [JsonPropertyName("Version")] public string Version { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneResult.cs index b64303b..cdeac92 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Timezone/TimezoneResult.cs @@ -1,19 +1,19 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Timezone { public class TimezoneResult { - [JsonProperty("count")] + [JsonPropertyName("Count")] public int Count { get; set; } - [JsonProperty("referenceUtcTimestamp")] + [JsonPropertyName("ReferenceUtcTimestamp")] public string ReferenceUtcTimestamp { get; set; } - [JsonProperty("timeZones")] + [JsonPropertyName("TimeZones")] public Timezone[] TimeZones { get; set; } - [JsonProperty("version")] + [JsonPropertyName("Version")] public string Version { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Coordinates.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Coordinates.cs index 4dbe2e2..d37bc71 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Coordinates.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Coordinates.cs @@ -1,11 +1,11 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { public class Coordinates { - [JsonProperty("coordinate")] + [JsonPropertyName("coordinate")] public Coordinate[] Coordinate { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/FlowSegmentData.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/FlowSegmentData.cs index 68c7a48..54090d6 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/FlowSegmentData.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/FlowSegmentData.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -13,49 +13,49 @@ public class FlowSegmentData /// /// @Version property /// - [JsonProperty("@version")] + [JsonPropertyName("@version")] public string Version { get; set; } /// /// Confidence property /// - [JsonProperty("confidence")] + [JsonPropertyName("confidence")] public double Confidence { get; set; } /// /// Coordinates of the result /// - [JsonProperty("coordinates")] + [JsonPropertyName("coordinates")] public Coordinates Coordinates { get; set; } /// /// Current Speed property /// - [JsonProperty("currentSpeed")] + [JsonPropertyName("currentSpeed")] public int CurrentSpped { get; set; } /// /// Current Travel Time property /// - [JsonProperty("currentTravelTime")] + [JsonPropertyName("currentTravelTime")] public int currentTravelTime { get; set; } /// /// FRC property /// - [JsonProperty("frc")] + [JsonPropertyName("frc")] public string FRC { get; set; } /// /// Free Flow Speed property /// - [JsonProperty("freeFlowSpeed")] + [JsonPropertyName("freeFlowSpeed")] public int FreeFlowSpeed { get; set; } /// /// Free Flow Travel Time property /// - [JsonProperty("freeFlowTravelTime")] + [JsonPropertyName("freeFlowTravelTime")] public int FreeFlowTravelTime { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Point.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Point.cs index 22dda2a..a7a94d0 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Point.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Point.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -7,13 +7,13 @@ public class Point /// /// x coordinate /// - [JsonProperty("x")] + [JsonPropertyName("x")] public double X { get; set; } /// /// y coordinate /// - [JsonProperty("y")] + [JsonPropertyName("y")] public double Y { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Tm.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Tm.cs index 9136da6..3b4cfd3 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Tm.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/Tm.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -10,13 +10,13 @@ public class Tm /// /// ID of the traffic incident /// - [JsonProperty("@id")] + [JsonPropertyName("@id")] public string Id { get; set; } /// /// A single traffic incident, or a cluster of traffic incidents /// - [JsonProperty("poi")] + [JsonPropertyName("poi")] public TrafficIncidentPoi[] Poi { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentRequest.cs index 39f7114..6a2f2ae 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentRequest.cs @@ -1,5 +1,5 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -33,7 +33,7 @@ public class TrafficFlowSegmentRequest : RequestBase /// /// The style to be used to render the tile. Valid values are absolute which returns colors reflecting the absolute speed measured, relative which returns the speed relative to free-flow, Relative-delay which displays relative speeds only where they are different from the freeflow speeds /// - [JsonProperty("style")] + [JsonPropertyName("style")] public TrafficFlowSegmentStyle Style { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentResult.cs index ab80588..81b841a 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowSegmentResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; using System; using System.Collections.Generic; using System.Text; @@ -13,7 +13,7 @@ public class TrafficFlowSegmentResult /// /// Flow Segment Data property /// - [JsonProperty("flowSegmentData")] + [JsonPropertyName("flowSegmentData")] public FlowSegmentData FlowSegmentData { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowTileRequest.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowTileRequest.cs index 0f677b9..55ba82c 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowTileRequest.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficFlowTileRequest.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -9,13 +9,13 @@ public class TrafficFlowTileRequest : TrafficRequestTileBase /// /// The value of the width of the line representing traffic. This value is a multiplier and the accepted values range from 1 - 20. The default value is 10. /// - [JsonProperty("thickness")] + [JsonPropertyName("thickness")] public int? Thickness { get; set; } = 1; /// /// The style to be used to render the tile. Valid values are absolute which returns colors reflecting the absolute speed measured, relative which returns the speed relative to free-flow, Relative-delay which displays relative speeds only where they are different from the freeflow speeds /// - [JsonProperty("style")] + [JsonPropertyName("style")] public TrafficFlowSegmentStyle Style { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentDetailResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentDetailResult.cs index ff27599..a3e5f55 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentDetailResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentDetailResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -10,7 +10,7 @@ public class TrafficIncidentDetailResult /// /// Main response element /// - [JsonProperty("tm")] + [JsonPropertyName("tm")] public Tm Tm { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentPoi.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentPoi.cs index ac02bd3..2a04135 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentPoi.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentPoi.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -7,79 +7,79 @@ public class TrafficIncidentPoi /// /// Cause of the incident, where available, in the language requested /// - [JsonProperty("c")] + [JsonPropertyName("c")] public string C { get; set; } /// /// Bottom left coordinate of the cluster in the projection of the request /// - [JsonProperty("cbl")] + [JsonPropertyName("cbl")] public Point Cbl { get; set; } /// /// Cluster size: the number of incidents in the cluster /// - [JsonProperty("cs")] + [JsonPropertyName("cs")] public int? Cs { get; set; } /// /// Top right coordinate of the cluster in the projection of the request /// - [JsonProperty("ctr")] + [JsonPropertyName("ctr")] public Point Ctr { get; set; } /// /// Description of the incident in the language requested /// - [JsonProperty("d")] + [JsonPropertyName("d")] public string D { get; set; } /// /// Delay caused by the incident in seconds (except in road closures) /// - [JsonProperty("dl")] + [JsonPropertyName("dl")] public int? Dl { get; set; } /// /// From: the name of the intersection or location where the traffic due to the incident starts /// - [JsonProperty("f")] + [JsonPropertyName("f")] public string F { get; set; } /// /// The icon category associated with this incident. Values are numbers in the range 0-13, with the following meanings /// - [JsonProperty("ic")] + [JsonPropertyName("ic")] public int? IC { get; set; } /// /// ID of the traffic incident /// - [JsonProperty("id")] + [JsonPropertyName("id")] public string Id { get; set; } /// /// The point where an icon of the cluster or raw incident should be drawn, expressed in the requested projection. This is affected by traffic style, zoom level and road type /// - [JsonProperty("p")] + [JsonPropertyName("p")] public Point P { get; set; } /// /// The road number(s) affected by the incident. Multiple road numbers will delimited by slashes /// - [JsonProperty("r")] + [JsonPropertyName("r")] public string R { get; set; } /// /// To: the name of the intersection or location where the traffic due to the incident ends /// - [JsonProperty("t")] + [JsonPropertyName("t")] public string T { get; set; } /// /// The magnitude of delay associated with incident. These values correspond to incident colors in the traffic tiles /// - [JsonProperty("ty")] + [JsonPropertyName("ty")] public int? Ty { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentViewportResult.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentViewportResult.cs index 3fbf244..74c261d 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentViewportResult.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficIncidentViewportResult.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -10,7 +10,7 @@ public class TrafficIncidentViewportResult /// /// Viewport Response object /// - [JsonProperty("viewpResp")] + [JsonPropertyName("viewpResp")] public ViewpResp ViewpResp { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficRequestTileBase.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficRequestTileBase.cs index ea62726..8e17b26 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficRequestTileBase.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficRequestTileBase.cs @@ -1,5 +1,5 @@ using AzureMapsToolkit.Common; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -8,19 +8,19 @@ public class TrafficRequestTileBase: RequestBase /// /// Zoom level for the desired tile. Zoom value must be in the range: 0-18 (inclusive). /// - [JsonProperty("zoom")] + [JsonPropertyName("zoom")] public int Zoom { get; set; } /// /// X coordinate of the tile on zoom grid. Value must be in the range [0, 2zoom -1]. /// - [JsonProperty("x")] + [JsonPropertyName("x")] public int X { get; set; } /// /// Y coordinate of the tile on zoom grid. Value must be in the range [0, 2zoom -1]. /// - [JsonProperty("y")] + [JsonPropertyName("y")] public int Y { get; set; } } } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficState.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficState.cs index 33610e9..f5f77f5 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficState.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/TrafficState.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -10,13 +10,13 @@ public class TrafficState /// /// @Traffic Age property /// - [JsonProperty("@trafficAge")] + [JsonPropertyName("@trafficAge")] public int TrafficAge { get; set; } /// /// @Traffic Model Id property /// - [JsonProperty("@trafficModelId")] + [JsonPropertyName("@trafficModelId")] public string TrafficModelId { get; set; } } } \ No newline at end of file diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/ViewpResp.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/ViewpResp.cs index 2300750..a92fd41 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/ViewpResp.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Traffic/ViewpResp.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AzureMapsToolkit.Traffic { @@ -10,25 +10,25 @@ public class ViewpResp /// /// @maps property /// - [JsonProperty("@maps")] + [JsonPropertyName("@maps")] public string Maps { get; set; } /// /// @Version property /// - [JsonProperty("@version")] + [JsonPropertyName("@version")] public string Version { get; set; } /// /// Copyright Ids property /// - [JsonProperty("copyrightIds")] + [JsonPropertyName("copyrightIds")] public string CopyrightIds { get; set; } /// /// Traffic State array /// - [JsonProperty("trafficState")] + [JsonPropertyName("trafficState")] public TrafficState TrafficState { get; set; } } } \ No newline at end of file diff --git a/AzureMapsToolkit-Core-Test/AzureMapsToolkit-Core-Test.csproj b/AzureMapsToolkit-Core-Test/AzureMapsToolkit-Core-Test.csproj index fb9aa92..d129a7c 100644 --- a/AzureMapsToolkit-Core-Test/AzureMapsToolkit-Core-Test.csproj +++ b/AzureMapsToolkit-Core-Test/AzureMapsToolkit-Core-Test.csproj @@ -1,18 +1,21 @@ - netcoreapp2.0 + net5.0 AzureMapsToolkit_Core_Test false - - - - - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/AzureMapsToolkit-Core-Test/UnitTest.cs b/AzureMapsToolkit-Core-Test/UnitTest.cs index af1b6a3..195b6b2 100644 --- a/AzureMapsToolkit-Core-Test/UnitTest.cs +++ b/AzureMapsToolkit-Core-Test/UnitTest.cs @@ -1,20 +1,21 @@ -using AzureMapsToolkit.Common; -using AzureMapsToolkit.Search; -using AzureMapsToolkit.Timezone; -using GeoJSON.Net.Geometry; -using Newtonsoft.Json; +using System; using System.Collections.Generic; -using Xunit; using System.Linq; -using AzureMapsToolkit.Traffic; -using AzureMapsToolkit.Render; -using AzureMapsToolkit; +using System.Text.Json; using System.Threading.Tasks; -using System; -using System.IO; -using static System.Net.Mime.MediaTypeNames; + +using Azure.Core.GeoJson; + +using AzureMapsToolkit; +using AzureMapsToolkit.Common; using AzureMapsToolkit.Mobility; +using AzureMapsToolkit.Render; using AzureMapsToolkit.Route; +using AzureMapsToolkit.Search; +using AzureMapsToolkit.Timezone; +using AzureMapsToolkit.Traffic; + +using Xunit; namespace AzureMapsToolkit_Core_Test { @@ -79,7 +80,7 @@ public void GetCopyrightForTile() public void GetCopyrightForWorld() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); - var resp = am.GetCopyrightForWorld().Result; + _ = am.GetCopyrightForWorld().Result; } @@ -199,61 +200,64 @@ public void GetPostRouteDirections() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); - var req = new List(); - req.Add(new PostRouteDirectionsRequest + var req = new List { - Query = "47.620659,-122.348934:47.610101,-122.342015", - RouteType = RouteType.Fastest, - TravelMode = TravelMode.Car - }); + new PostRouteDirectionsRequest + { + Query = "47.620659,-122.348934:47.610101,-122.342015", + RouteType = RouteType.Fastest, + TravelMode = TravelMode.Car + }, - req.Add(new PostRouteDirectionsRequest - { - Query = "40.759856,-73.985108:40.771136,-73.973506", - TravelMode = TravelMode.Pedestrian, - RouteType = RouteType.Shortest - }); + new PostRouteDirectionsRequest + { + Query = "40.759856,-73.985108:40.771136,-73.973506", + TravelMode = TravelMode.Pedestrian, + RouteType = RouteType.Shortest + }, - req.Add(new PostRouteDirectionsRequest - { - Query = "48.923159,-122.557362:32.621279,-116.840362" - }); + new PostRouteDirectionsRequest + { + Query = "48.923159,-122.557362:32.621279,-116.840362" + } + }; - var result = am.GetRouteDirections(req).Result; + var (ResultUrl, ex) = am.GetRouteDirections(req).Result; - Assert.Null(result.ex); + Assert.Null(ex); - Assert.NotNull(result.ResultUrl); + Assert.NotNull(ResultUrl); - Assert.True(result.ResultUrl.Length > 0); + Assert.True(ResultUrl.Length > 0); } - + [Fact] public void GetDistanceMatrix() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); - var req = new RouteMatrixRequest(); - req.RouteType = RouteType.Fastest; var origins = new List { - new Coordinate { Longitude = 4.85106f, Latitude = 52.36006f } - , new Coordinate { Longitude = 4.85056f, Latitude = 52.36187f} + new Coordinate { Longitude = 4.85106f, Latitude = 52.36006f }, + new Coordinate { Longitude = 4.85056f, Latitude = 52.36187f} }; var destinations = new List { - new Coordinate { Longitude = 4.85003f, Latitude = 52.36241f } - , new Coordinate { Longitude = 13.42937f, Latitude = 52.50931f} + new Coordinate { Longitude = 4.85003f, Latitude = 52.36241f }, + new Coordinate { Longitude = 13.42937f, Latitude = 52.50931f} }; - var result = am.GetRouteMatrix(req, origins, destinations).Result; + var (ResultUrl, ex) = am.GetRouteMatrix(new RouteMatrixRequest + { + RouteType = RouteType.Fastest + }, origins, destinations).Result; - Assert.Null(result.ex); + Assert.Null(ex); - Assert.NotNull(result.ResultUrl); + Assert.NotNull(ResultUrl); GetDistanceMatrixResult(); @@ -264,23 +268,24 @@ public void GetDistanceMatrixResult() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); - var req = new RouteMatrixRequest(); - req.RouteType = RouteType.Fastest; + var req = new RouteMatrixRequest + { + RouteType = RouteType.Fastest + }; var origins = new List { - new Coordinate { Longitude = 4.85106f, Latitude = 52.36006f } - , new Coordinate { Longitude = 4.85056f, Latitude = 52.36187f} + new Coordinate { Longitude = 4.85106f, Latitude = 52.36006f }, + new Coordinate { Longitude = 4.85056f, Latitude = 52.36187f} }; var destinations = new List { - new Coordinate { Longitude = 4.85003f, Latitude = 52.36241f } - , new Coordinate { Longitude = 13.42937f, Latitude = 52.50931f} + new Coordinate { Longitude = 4.85003f, Latitude = 52.36241f }, + new Coordinate { Longitude = 13.42937f, Latitude = 52.50931f} }; + var (ResultUrl, _) = am.GetRouteMatrix(req, origins, destinations).Result; - var result = am.GetRouteMatrix(req, origins, destinations).Result; - - var matrixResponse = am.GetRouteMatrixResult(result.ResultUrl).Result; + var matrixResponse = am.GetRouteMatrixResult(ResultUrl).Result; Assert.Null(matrixResponse.Error); Assert.NotNull(matrixResponse.Result); @@ -323,7 +328,7 @@ public void GetSearchAddressReverse() { //Query = "37.337,-121.89", Query = "47.591180, -122.332700", - EntityType = SearchAddressEntityTypes.Municipality | SearchAddressEntityTypes.PostalCodeArea + EntityType = SearchAddressEntityType.Municipality | SearchAddressEntityType.PostalCodeArea }; var resp = am.GetSearchAddressReverse(req).Result; @@ -472,11 +477,11 @@ public void GetSearchAddressBatch() var req = new SearchAddressRequest[] { req1, req2, req3 }; - var res = am.GetSearchAddress(req).Result; + var (ResultUrl, ex) = am.GetSearchAddress(req).Result; - Assert.Null(res.ex); + Assert.Null(ex); - Assert.NotNull(res.ResultUrl); + Assert.NotNull(ResultUrl); } [Fact] @@ -499,11 +504,11 @@ public void GetSearchAddressReverseBatch() var req = new SearchAddressReverseRequest[] { q1, q2, q3 }; - var res = am.GetSearchAddressReverse(req).Result; + var (ResultUrl, ex) = am.GetSearchAddressReverse(req).Result; - Assert.Null(res.ex); + Assert.Null(ex); - Assert.NotNull(res.ResultUrl); + Assert.NotNull(ResultUrl); } [Fact] @@ -565,11 +570,11 @@ public void GetSeachFuzzyBatch() }; var req = new SearchFuzzyRequest[] { q1, q2, q3 }; - var res = am.GetSearchFuzzy(req).Result; + var (ResultUrl, ex) = am.GetSearchFuzzy(req).Result; - Assert.Null(res.ex); + Assert.Null(ex); - Assert.NotNull(res.ResultUrl); + Assert.NotNull(ResultUrl); } @@ -577,7 +582,7 @@ public void GetSeachFuzzyBatch() public void SearchInsidePolygon() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); - var coll = JsonConvert.DeserializeObject("{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Polygon\",\"coordinates\":[[[-122.43576049804686,37.7524152343544],[-122.43301391601562,37.70660472542312],[-122.36434936523437,37.712059855877314],[-122.43576049804686,37.7524152343544]]]}]}"); + var coll = JsonSerializer.Deserialize("{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Polygon\",\"coordinates\":[[[-122.43576049804686,37.7524152343544],[-122.43301391601562,37.70660472542312],[-122.36434936523437,37.712059855877314],[-122.43576049804686,37.7524152343544]]]}]}"); var d = am.GetSearchInsidePolygon(new SearchInsidePolygonRequest { Query = "burger" @@ -665,7 +670,7 @@ public void GetTimezoneWindowsToIANA() Assert.Null(r.Error); - Assert.NotNull(r.Result); + Assert.NotNull(r.Result); } [Fact] @@ -825,7 +830,7 @@ public void ListData() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); var res = am.GetList().Result; - Assert.InRange(res.Result.MapDataList.Count(), 0, int.MaxValue); + Assert.InRange(res.Result.MapDataList.Count, 0, int.MaxValue); } [Fact] @@ -1068,8 +1073,7 @@ public void GetRealTimeArrivals() public void GetTransitItenary() { var am = new AzureMapsToolkit.AzureMapsServices(_KEY); - - var res = am.GetTransitItinerary(new AzureMapsToolkit.Mobility.TransitItineraryRequest + _ = am.GetTransitItinerary(new AzureMapsToolkit.Mobility.TransitItineraryRequest { }).Result; } From 88b3fed0a99dc4e693007fca13e07cafe17a04f5 Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Fri, 4 Jun 2021 17:36:10 +0200 Subject: [PATCH 2/4] Fix test GetSearchAlongRoute --- .../AzureMapsRestToolkit/AzureMapsServices.cs | 16 +++++++--------- .../AzureMapsRestToolkit/GeoJson/LineString.cs | 4 +++- .../AzureMapsRestToolkit/IAzureMapsServices.cs | 2 +- AzureMapsToolkit-Core-Test/UnitTest.cs | 15 ++++++++------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs index bd083ad..8dd80f4 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs @@ -898,22 +898,20 @@ public virtual async Task> GetSearchPOICateg /// /// /// - public virtual async Task> GetSearchAlongRoute(SearchAlongRouteRequest req, LineString lineString) + public virtual async Task> GetSearchAlongRoute(SearchAlongRouteRequest req, GeoLineString lineString) { try { - var bodyContent = new { route = lineString }; - //ToDo - var queryContent = ""; // JsonSerializer.Deserialize(bodyContent); + string queryContent = "{\"route\":" + JsonSerializer.Serialize(lineString) + "}"; - var args = GetQuery(req, true); + string args = GetQuery(req, true); - var url = $"{baseDomain}/search/alongRoute/json?subscription-key={Key}&api-version=1.0{args}"; + string url = $"{baseDomain}/search/alongRoute/json?subscription-key={Key}&api-version=1.0{args}"; - using var responseMsg = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post); - using var data = responseMsg.Content; - var content = await data.ReadAsStringAsync(); + using HttpResponseMessage responseMsg = await GetHttpResponseMessage(url, queryContent, HttpMethod.Post); + using HttpContent data = responseMsg.Content; + string content = await data.ReadAsStringAsync(); var response = JsonSerializer.Deserialize(content); return Response.CreateResponse(response); } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs index c2b928a..1d8886f 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/GeoJson/LineString.cs @@ -1,6 +1,8 @@ using System.Text.Json; using System.Text.Json.Serialization; +using AzureMapsToolkit.Traffic; + namespace AzureMapsToolkit.GeoJson { public class LineString @@ -9,7 +11,7 @@ public class LineString public string Type { get { return "LineString"; } } [JsonPropertyName("coordinates")] - public double[,] Coordinates { get; set; } + public Coordinates Coordinates { get; set; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs index da84129..3f3f118 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/IAzureMapsServices.cs @@ -109,7 +109,7 @@ public interface IAzureMapsServices Task<(string ResultUrl, Exception ex)> GetSearchAddressReverse(IEnumerable req); - Task> GetSearchAlongRoute(SearchAlongRouteRequest req, LineString lineString); + Task> GetSearchAlongRoute(SearchAlongRouteRequest req, GeoLineString lineString); Task<(string ResultUrl, Exception ex)> GetSearchFuzzy(IEnumerable req); diff --git a/AzureMapsToolkit-Core-Test/UnitTest.cs b/AzureMapsToolkit-Core-Test/UnitTest.cs index 195b6b2..72e7a2a 100644 --- a/AzureMapsToolkit-Core-Test/UnitTest.cs +++ b/AzureMapsToolkit-Core-Test/UnitTest.cs @@ -8,6 +8,7 @@ using AzureMapsToolkit; using AzureMapsToolkit.Common; +using AzureMapsToolkit.GeoJson; using AzureMapsToolkit.Mobility; using AzureMapsToolkit.Render; using AzureMapsToolkit.Route; @@ -523,16 +524,16 @@ public void GetSearchAlongRoute() Query = "burger" }; - var lineString = new AzureMapsToolkit.GeoJson.LineString + List coordinates = new() { - Coordinates = new double[,] { - { -122.143035, 47.653536 }, - {-122.187164, 47.617556 }, - { -122.114981, 47.570599}, - { -122.132756, 47.654009} - } + new GeoPosition(-122.143035, 47.653536), + new GeoPosition(-122.187164, 47.617556), + new GeoPosition(-122.114981, 47.570599), + new GeoPosition(-122.132756, 47.654009) }; + GeoLineString lineString = new (coordinates); + var result = am.GetSearchAlongRoute(req, lineString).Result; Assert.Null(result.Error); From 79f5cfc33f6c4d082967d78b90147b8f58d00efe Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Fri, 4 Jun 2021 17:51:01 +0200 Subject: [PATCH 3/4] Fix GetSearchAddressReverse --- .../AzureMapsRestToolkit/AzureMapsServices.cs | 2 +- .../AzureMapsRestToolkit/Common/BaseServices.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs index 8dd80f4..94e2e74 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/AzureMapsServices.cs @@ -761,7 +761,7 @@ public virtual async Task> GetSearchAddress(Sear public virtual async Task> GetSearchAddressReverse(SearchAddressReverseRequest request) { - var res = await ExecuteRequest($"{baseDomain}/search/address/reverse/json", request); + var res = await ExecuteRequest($"{baseDomain}/search/address/reverse/json", request, false); return res; } diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs index c473a7f..8032609 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Common/BaseServices.cs @@ -82,7 +82,7 @@ internal IEnumerable GetSearchQuery(IEnumerable req) where T : Req } } - internal string GetQuery(T request, bool includeApiVersion, bool includeLanguage = true, char firstChar = '&') + internal string GetQuery(T request, bool includeApiVersion, bool includeLanguage = true, char firstChar = '&', bool toCamelCase = true) where T : RequestBase { Type type = request.GetType(); @@ -103,8 +103,10 @@ internal string GetQuery(T request, bool includeApiVersion, bool includeLangu if (propertyInfo?.PropertyType.IsEnum == true || underLayingtype?.IsEnum == true) { argumentName = Char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name[1..]; + argumentValue = propertyInfo.GetValue(request).ToString().Replace(" ", ""); - argumentValue = propertyInfo.GetValue(request).ToString().Replace(" ", "").ToCamelCase(); + if (toCamelCase) + argumentValue = argumentValue.ToCamelCase(); } //else if (propertyInfo != null && propertyInfo.PropertyType.IsArray) //{ @@ -173,13 +175,13 @@ internal static async Task GetByteArray(string baseAddress, string url) return content; } - internal async Task> ExecuteRequest(string baseUrl, U req) where U : RequestBase + internal async Task> ExecuteRequest(string baseUrl, U req, bool toCamelCase = true) where U : RequestBase { Url = string.Empty; try { if (req != null) - Url += GetQuery(req, true); + Url += GetQuery(req, true, toCamelCase: toCamelCase); using HttpClient client = GetClient(baseUrl); T data = await GetData(client, Url); From 292e7eb34b788a6174ace39b9090411d27cf5588 Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Sat, 5 Jun 2021 10:12:33 +0200 Subject: [PATCH 4/4] Fix PostClosestPoint --- .../AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs index 022ef4e..4ff8c8d 100644 --- a/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs +++ b/AzureMapsRestToolkit/AzureMapsRestToolkit/Spatial/ClosestPointResultEntry.cs @@ -17,6 +17,7 @@ public class ClosestPointResultEntry /// The unique id identifies a geometry /// [JsonPropertyName("geometryId")] + [JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)] public int GeometryId { get; set; } ///