diff --git a/.nuget/packages.config b/.nuget/packages.config
deleted file mode 100644
index 7b21e2f6..00000000
--- a/.nuget/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/rosette_api.sln b/rosette_api.sln
deleted file mode 100644
index 5a508d5a..00000000
--- a/rosette_api.sln
+++ /dev/null
@@ -1,35 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "rosette_api", "rosette_api\rosette_api.csproj", "{D719A8A7-C5C7-49CF-BFFC-523D605E5E37}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "rosette_apiUnitTests", "rosette_apiUnitTests\rosette_apiUnitTests.csproj", "{10EAD22C-041F-4436-A391-935897309C23}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F17AACDD-48B8-43EA-BF0C-0129592B2BC9}"
- ProjectSection(SolutionItems) = preProject
- .nuget\packages.config = .nuget\packages.config
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2F9FBE70-5FE8-4A79-96B1-E504266A3CE1}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D719A8A7-C5C7-49CF-BFFC-523D605E5E37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D719A8A7-C5C7-49CF-BFFC-523D605E5E37}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D719A8A7-C5C7-49CF-BFFC-523D605E5E37}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D719A8A7-C5C7-49CF-BFFC-523D605E5E37}.Release|Any CPU.Build.0 = Release|Any CPU
- {10EAD22C-041F-4436-A391-935897309C23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {10EAD22C-041F-4436-A391-935897309C23}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {10EAD22C-041F-4436-A391-935897309C23}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {10EAD22C-041F-4436-A391-935897309C23}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/rosette_api.slnx b/rosette_api.slnx
new file mode 100644
index 00000000..a9d394bd
--- /dev/null
+++ b/rosette_api.slnx
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/rosette_api/Address.cs b/rosette_api/Address.cs
index 66720ac0..b5105450 100644
--- a/rosette_api/Address.cs
+++ b/rosette_api/Address.cs
@@ -1,27 +1,27 @@
namespace rosette_api
{
- public class Address: IAddress
+ public class Address : IAddress
{
- public Address(string house = null, string houseNumber = null, string road = null, string unit = null, string level = null, string staircase = null, string entrance = null, string suburb = null, string cityDistrict = null, string city = null, string island = null, string stateDistrict = null, string state = null, string countryRegion = null, string country = null, string worldRegion = null, string postCode = null, string poBox = null)
+ public Address(string? house = null, string? houseNumber = null, string? road = null, string? unit = null, string? level = null, string? staircase = null, string? entrance = null, string? suburb = null, string? cityDistrict = null, string? city = null, string? island = null, string? stateDistrict = null, string? state = null, string? countryRegion = null, string? country = null, string? worldRegion = null, string? postCode = null, string? poBox = null)
{
- this.house = house;
- this.houseNumber = houseNumber;
- this.road = road;
- this.unit = unit;
- this.level = level;
- this.staircase = staircase;
- this.entrance = entrance;
- this.suburb = suburb;
- this.cityDistrict = cityDistrict;
- this.city = city;
- this.island = island;
- this.stateDistrict = stateDistrict;
- this.state = state;
- this.countryRegion = countryRegion;
- this.country = country;
- this.worldRegion = worldRegion;
- this.postCode = postCode;
- this.poBox = poBox;
+ this.House = house;
+ this.HouseNumber = houseNumber;
+ this.Road = road;
+ this.Unit = unit;
+ this.Level = level;
+ this.Staircase = staircase;
+ this.Entrance = entrance;
+ this.Suburb = suburb;
+ this.CityDistrict = cityDistrict;
+ this.City = city;
+ this.Island = island;
+ this.StateDistrict = stateDistrict;
+ this.State = state;
+ this.CountryRegion = countryRegion;
+ this.Country = country;
+ this.WorldRegion = worldRegion;
+ this.PostCode = postCode;
+ this.PoBox = poBox;
}
/// house
@@ -29,130 +29,130 @@ public Address(string house = null, string houseNumber = null, string road = nul
/// Getter, Setter for the house
///
///
- public string house { get; set; }
+ public string? House { get; set; }
/// houseNumber
///
/// Getter, Setter for the houseNumber
///
///
- public string houseNumber { get; set; }
+ public string? HouseNumber { get; set; }
/// road
///
/// Getter, Setter for the road
///
///
- public string road { get; set; }
+ public string? Road { get; set; }
/// unit
///
/// Getter, Setter for the unit
///
///
- public string unit { get; set; }
+ public string? Unit { get; set; }
/// level
///
/// Getter, Setter for the level
///
///
- public string level { get; set; }
+ public string? Level { get; set; }
/// staircase
///
/// Getter, Setter for the staircase
///
///
- public string staircase { get; set; }
+ public string? Staircase { get; set; }
/// entrance
///
/// Getter, Setter for the entrance
///
///
- public string entrance { get; set; }
+ public string? Entrance { get; set; }
/// suburb
///
/// Getter, Setter for the suburb
///
///
- public string suburb { get; set; }
+ public string? Suburb { get; set; }
/// cityDistrict
///
/// Getter, Setter for the cityDistrict
///
///
- public string cityDistrict { get; set; }
+ public string? CityDistrict { get; set; }
/// city
///
/// Getter, Setter for the city
///
///
- public string city { get; set; }
+ public string? City { get; set; }
/// island
///
/// Getter, Setter for the island
///
///
- public string island { get; set; }
+ public string? Island { get; set; }
/// stateDistrict
///
/// Getter, Setter for the stateDistrict
///
///
- public string stateDistrict { get; set; }
+ public string? StateDistrict { get; set; }
/// state
///
/// Getter, Setter for the state
///
///
- public string state { get; set; }
+ public string? State { get; set; }
/// countryRegion
///
/// Getter, Setter for the countryRegion
///
///
- public string countryRegion { get; set; }
+ public string? CountryRegion { get; set; }
/// country
///
/// Getter, Setter for the country
///
///
- public string country { get; set; }
+ public string? Country { get; set; }
/// worldRegion
///
/// Getter, Setter for the worldRegion
///
///
- public string worldRegion { get; set; }
+ public string? WorldRegion { get; set; }
/// postCode
///
/// Getter, Setter for the postCode
///
///
- public string postCode { get; set; }
+ public string? PostCode { get; set; }
/// poBox
///
/// Getter, Setter for the poBox
///
///
- public string poBox { get; set; }
+ public string? PoBox { get; set; }
/// is this address fielded?
///
- public bool fielded()
+ public bool Fielded()
{
return true;
}
diff --git a/rosette_api/AddressSimilarityResponse.cs b/rosette_api/AddressSimilarityResponse.cs
index 610b73fc..c69bd068 100644
--- a/rosette_api/AddressSimilarityResponse.cs
+++ b/rosette_api/AddressSimilarityResponse.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using Newtonsoft.Json;
-using System.Net.Http;
+using Newtonsoft.Json;
namespace rosette_api
{
diff --git a/rosette_api/CAPI.cs b/rosette_api/CAPI.cs
index 51ee81ff..1e1602d7 100644
--- a/rosette_api/CAPI.cs
+++ b/rosette_api/CAPI.cs
@@ -1,12 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.IO;
+using System.Collections.Specialized;
using System.IO.Compression;
-using System.Linq;
using System.Net;
-using System.Net.Http;
-using System.Threading.Tasks;
using System.Text;
using Newtonsoft.Json;
@@ -49,13 +43,13 @@ public class CAPI
/// setupLock is used to ensure that the setup operation cannot be run
/// by multiple processes
///
- private Object setupLock = new Object();
+ private readonly Lock setupLock = new();
///
/// Internal string to hold the uri ending for each endpoint.
/// Set when an endpoint is called.
///
- private string _uri = null;
+ private string? _uri = null;
///
/// Internal container for options
@@ -75,12 +69,12 @@ public class CAPI
///
/// Http client to be used for life of API object
///
- private HttpClient _httpClient = null;
+ private HttpClient? _httpClient = null;
///
/// Reference to external http client, if provided
///
- private HttpClient _externalHttpClient = null;
+ private HttpClient? _externalHttpClient = null;
///
/// Current timeout value for the http client in milliseconds
@@ -109,7 +103,7 @@ public class CAPI
/// (string, optional): Base URL for the HttpClient requests. If none is given, will use the default API URI
/// (int, optional): Maximum number of times to retry a request on HttpResponse error. Default is 3 times.
/// (HttpClient, optional): Forces the API to use a custom HttpClient.
- public CAPI(string user_key, string uristring = "https://analytics.babelstreet.com/rest/v1/", int maxRetry = 5, HttpClient client = null)
+ public CAPI(string user_key, string uristring = "https://analytics.babelstreet.com/rest/v1/", int maxRetry = 5, HttpClient? client = null)
{
UserKey = user_key;
URIstring = uristring ?? "https://analytics.babelstreet.com/rest/v1/";
@@ -120,9 +114,9 @@ public CAPI(string user_key, string uristring = "https://analytics.babelstreet.c
MaxRetry = (maxRetry == 0) ? 1 : maxRetry;
MillisecondsBetweenRetries = 5000;
_externalHttpClient = client;
- _options = new Dictionary();
- _customHeaders = new Dictionary();
- _urlParameters = new NameValueCollection();
+ _options = [];
+ _customHeaders = [];
+ _urlParameters = [];
SetupClient();
}
@@ -149,21 +143,14 @@ public CAPI(string user_key, string uristring = "https://analytics.babelstreet.c
/// Version: Internal Server Version number.
///
///
- public static string Version
- {
- get { return typeof(CAPI).Assembly.GetName().Version.ToString(); }
- }
+ public static string Version => typeof(CAPI).Assembly.GetName().Version.ToString();
+
///
/// UserAgent returns the string that will be used for User-Agent
///
/// string User-Agent
- public string UserAgent
- {
- get
- {
- return string.Format("Babel-Street-Analytics-API-Csharp/{0}/{1}", Version, Environment.Version.ToString());
- }
- }
+ public static string UserAgent => string.Format("Babel-Street-Analytics-API-Csharp/{0}/{1}", Version, Environment.Version.ToString());
+
/// MaxRetry
///
/// Getter, Setter for the MaxRetry
@@ -186,10 +173,7 @@ public string UserAgent
/// client with some added headers that are required by the Analytics API. For the default internal client
/// it will return the current instance, which is maintained at the class level.
///
- public HttpClient Client
- {
- get { return _externalHttpClient ?? _httpClient; }
- }
+ public HttpClient Client => _externalHttpClient ?? _httpClient;
/// Concurrency
/// Returns the number of concurrent connections allowed by the current Analytics API plan.
@@ -282,7 +266,7 @@ public void SetOption(string name, object value)
///
/// string option name
/// object value if exists
- public object GetOption(string name)
+ public object? GetOption(string name)
{
if (_options.ContainsKey(name))
{
@@ -398,7 +382,7 @@ public AddressSimilarityResponse AddressSimilarity(IAddress a1, IAddress a2)
{
_uri = "address-similarity";
- Dictionary