From 1e3480e462904f2d5e9f684fc22ef23165188117 Mon Sep 17 00:00:00 2001 From: Dave Timmins Date: Wed, 1 Nov 2017 08:37:04 +1300 Subject: [PATCH] update suggest --- MIGRATION.md | 8 ++-- README.md | 1 + .../ArcGISOnlineAppLoginOAuthProvider.cs | 2 +- src/Anywhere.ArcGIS/CryptoProviderFactory.cs | 4 +- .../Operation/SingleInputGeocode.cs | 38 ++++++++++++++----- .../SecureGISGatewayTests.cs | 1 - 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index de6807e..5e1dcf3 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,13 +1,15 @@ Why the change? Well there are 2 main reasons, the first is that this is now a netstandard library rather than a portable class library (PCL), so the old naming didn't really apply. Secondly, NuGet now has package Id reservations and so I can't use ArcGIS as the suffix anymore. -To migrate from ArcGIS.PCL to Anywhere.ArcGIS the following breaking changes need to be done / reviewed: +To migrate from [ArcGIS.PCL](https://github.com/davetimmins/ArcGIS.PCL/) to [Anywhere.ArcGIS](https://github.com/davetimmins/Anywhere.ArcGIS/) the following __breaking__ :boom: changes need to be done / reviewed: - All namespaces have changed from `ArcGIS.ServiceModel.*` to `Anywhere.ArcGIS.*`. -- You no longer need to call the static `ISerializer` `Init()` method as JSON.NET is now baked in. +- You no longer need to call the static `ISerializer.Init()` method as JSON.NET is now baked in as the default. - `SecurePortalGateway` has been renamed to just `PortalGateway`. - Internally all requests now use an `ArcGISServerOperation` type, this allows before and after actions to be invoked for the HTTP request. -- Renamed `GdbVersion` to `GeodatabaseVersion`. \ No newline at end of file +- Renamed `GdbVersion` to `GeodatabaseVersion`. + +- Removed `Disabled` from `ICryptoProvider` and replaced it with `Enabled` which is `false` by default, so to opt in to trying to encrypt token requests (admin endpoint only) you now need to call `CryptoProviderFactory.Enabled = true;` once in your app code. \ No newline at end of file diff --git a/README.md b/README.md index 03f1ae1..72bcff3 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Supports the following as typed operations: - `QueryForExtent` return the bounding extent for the result of the query operation - `Find` search across _n_ layers and fields in a service - `ApplyEdits` post adds, updates and deletes to a feature service layer + - `DeleteFeatures` delete features in a feature layer or table - `Geocode` single line of input to perform a geocode using a custom locator or the Esri world locator - `Suggest` lightweight geocode operation that only returns text results, commonly used for predictive searching - `ReverseGeocode` find location candidates for a input point location diff --git a/src/Anywhere.ArcGIS/ArcGISOnlineAppLoginOAuthProvider.cs b/src/Anywhere.ArcGIS/ArcGISOnlineAppLoginOAuthProvider.cs index c4ecc40..445feb7 100644 --- a/src/Anywhere.ArcGIS/ArcGISOnlineAppLoginOAuthProvider.cs +++ b/src/Anywhere.ArcGIS/ArcGISOnlineAppLoginOAuthProvider.cs @@ -75,7 +75,7 @@ public void Dispose() public string RootUrl { - get { return "https://www.arcgis.com/sharing/oauth2/token"; } + get { return "https://www.arcgis.com/sharing/rest/oauth2/token"; } } public bool CancelPendingRequests { get; set; } diff --git a/src/Anywhere.ArcGIS/CryptoProviderFactory.cs b/src/Anywhere.ArcGIS/CryptoProviderFactory.cs index ab0e74c..d0b08aa 100644 --- a/src/Anywhere.ArcGIS/CryptoProviderFactory.cs +++ b/src/Anywhere.ArcGIS/CryptoProviderFactory.cs @@ -7,11 +7,11 @@ public static class CryptoProviderFactory { public static Func Get { get; set; } - public static bool Disabled { get; set; } + public static bool Enabled { get; set; } static CryptoProviderFactory() { - Get = (() => { return Disabled ? null : new RsaEncrypter(); }); + Get = (() => { return Enabled ? new RsaEncrypter() : null; }); } } diff --git a/src/Anywhere.ArcGIS/Operation/SingleInputGeocode.cs b/src/Anywhere.ArcGIS/Operation/SingleInputGeocode.cs index 8c8f5dc..3a0b7e3 100644 --- a/src/Anywhere.ArcGIS/Operation/SingleInputGeocode.cs +++ b/src/Anywhere.ArcGIS/Operation/SingleInputGeocode.cs @@ -32,9 +32,9 @@ public SingleInputGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest = public string SourceCountry { get; set; } /// - /// The maximum number of results to be returned by a search, up to the maximum number allowed by the service. - /// If not specified, then one location will be returned. - /// The world geocoding service allows up to 20 candidates to be returned for a single request. + /// The maximum number of results to be returned by a search, up to the maximum number allowed by the service. + /// If not specified, then one location will be returned. + /// The world geocoding service allows up to 20 candidates to be returned for a single request. /// Note that up to 50 POI candidates can be returned /// [DataMember(Name = "maxLocations")] @@ -44,8 +44,8 @@ public SingleInputGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest = public string MagicKey { get; set; } /// - /// A set of bounding box coordinates that limit the search area to a specific region. - /// This is especially useful for applications in which a user will search for places and addresses only within the current map extent. + /// A set of bounding box coordinates that limit the search area to a specific region. + /// This is especially useful for applications in which a user will search for places and addresses only within the current map extent. /// [DataMember(Name = "bbox")] public Extent SearchExtent { get; set; } @@ -60,10 +60,10 @@ public SingleInputGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest = public string OutFieldsValue { get { return OutFields == null ? string.Empty : string.Join(",", OutFields); } } /// - /// The spatial reference of the x/y coordinates returned by a geocode request. - /// This is useful for applications using a map with a spatial reference different than that of the geocode service. - /// If the outSR is not specified, the spatial reference of the output locations is the same as that of the service. - /// The world geocoding service spatial reference is WGS84 (WKID = 4326). + /// The spatial reference of the x/y coordinates returned by a geocode request. + /// This is useful for applications using a map with a spatial reference different than that of the geocode service. + /// If the outSR is not specified, the spatial reference of the output locations is the same as that of the service. + /// The world geocoding service spatial reference is WGS84 (WKID = 4326). /// [DataMember(Name = "outSR")] public SpatialReference OutputSpatialReference { get; set; } @@ -93,7 +93,7 @@ public class Location } /// - /// Call the suggest method for a locator. This has the parameters used by the hosted world geocoding service at geocode.arcgis.com + /// Call the suggest method for a locator. This has the parameters used by the hosted world geocoding service at geocode.arcgis.com /// [DataContract] public class SuggestGeocode : GeocodeOperation @@ -102,6 +102,7 @@ public SuggestGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest = null : base(new ArcGISServerEndpoint(endpoint.RelativeUrl.Trim('/') + "/" + Operations.SuggestGeocode), beforeRequest, afterRequest) { Distance = null; + MaxSuggestions = 5; } /// @@ -109,6 +110,23 @@ public SuggestGeocode(ArcGISServerEndpoint endpoint, Action beforeRequest = null /// [DataMember(Name = "text")] public string Text { get; set; } + + /// + /// The maximum number of suggestions returned by a suggest operation, up to the maximum number allowed by the service. + /// The default value is 5. + /// + [DataMember(Name = "maxSuggestions")] + public int MaxSuggestions { get; set; } + + /// + /// A set of bounding box coordinates that limit the search area for suggestions to a specific region. + /// This is especially useful for applications in which a user searches for places and addresses within the current map extent. + /// You can specify the spatial reference of the searchExtent coordinates, + /// which is necessary if the map spatial reference is different than that of the geocoding service; + /// otherwise, the spatial reference of the coordinates is assumed to be the same as that of the geocoding service. + /// + [DataMember(Name = "searchExtent")] + public Extent SearchExtent { get; set; } } [DataContract] diff --git a/tests/Anywhere.ArcGIS.Test.Integration/SecureGISGatewayTests.cs b/tests/Anywhere.ArcGIS.Test.Integration/SecureGISGatewayTests.cs index 3184deb..10667c4 100644 --- a/tests/Anywhere.ArcGIS.Test.Integration/SecureGISGatewayTests.cs +++ b/tests/Anywhere.ArcGIS.Test.Integration/SecureGISGatewayTests.cs @@ -15,7 +15,6 @@ public class SecureGISGatewayTests : IClassFixture public SecureGISGatewayTests(IntegrationTestFixture fixture, ITestOutputHelper output) { fixture.SetTestOutputHelper(output); - CryptoProviderFactory.Disabled = true; } [Theory]