A .NET library to use the what3words v3 API. API methods are grouped into a single service object which can be centrally managed by a What3WordsV3 instance. It will act as a factory for all of the API endpoints and will automatically initialize them with your API key. To obtain an API key, please visit https://what3words.com/select-plan and sign up for an account.
$ dotnet add package what3words.dotnet.wrapperAn .NET library to use the what3words v3 API.
API methods are grouped into a single service object which can be centrally managed by a What3WordsV3 instance. It will act as a factory for all of the API endpoints and will automatically initialize them with your API key.
The artifact is available through NuGet Package
See the what3words public API documentation
To obtain an API key, please visit https://what3words.com/select-plan and sign up for an account.
var wrapper = new What3WordsV3("YOUR_API_KEY_HERE");
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server like so:
var wrapper = new What3Words("YOUR_API_KEY_HERE", "https://api.yourserver.com")
var result = await wrapper.ConvertTo3WA(new Coordinates(51.222011, 0.152311)).RequestAsync();
var result = await wrapper.ConvertToCoordinates("filled.count.soap").RequestAsync();
var result = await wrapper.Autosuggest("index.home.r", new AutosuggestOptions().SetFocus(51.502,-0.12345)).RequestAsync();
var result = await wrapper.GridSection(new Coordinates(51.222011, 0.152311), new Coordinates(51.222609, 0.152898)).RequestAsync();
var result = await wrapper.AvailableLanguages().RequestAsync();
:warning: NOTE: Does not check if it is an actual existing 3WA.
var result = wrapper.IsPossible3wa("filled.count.so"); // true
:warning: NOTE: Does not check if it is an actual existing 3WA.
var result = wrapper.FindPossible3wa("from index.home.raft to filled.count.soap"); // IEnumerable<string>[ "index.home.raft", "filled.count.soap"]
var result = wrapper.IsValid3wa("filled.count.soap"); // true
To run the tests, you need to provide the following environment variables:
W3W_API_KEY - A valid API Key (with autosuggest with coordinates enabled - otherwise tests related to v3/autosuggest-with-endpoint will fail)W3W_API_ENDPOINT - (optional) You can override the default endpoint which is https://api.what3words.com (perhaps a self hosted or a local instance of the what3words api).dotnet test what3words.dotnet.wrapper.utests/what3words.dotnet.wrapper.utests.csproj
Test run for /w3w-dotnet-wrapper/what3words.dotnet.wrapper.utests/bin/Debug/net5.0/what3words.dotnet.wrapper.utests.dll(.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.11.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Test Run Successful.
Total tests: 42
Passed: 42
Total time: 7.0222 Seconds
AutosuggestInputType and Request<T> to what3words.dotnet.wrapper.request namespace