Loading...

.NET SDK

.NET SDK for working with security and resources.

Install

PM> Install-Package getAddress.Sdk

Dependency Injection

services.AddSingleton(s => new GetAddress.ApiKeys("API Key", "admin-key"));
services.AddHttpClient<GetAddress.Api>();

Autocomplete

Autocomplete and get address.

public async Task Autocomplete(GetAddress.Api api)
{
  var autocompleteResult = await api.Autocomplete("High St");

  if (autocompleteResult.IsSuccess)
  {
      foreach(var suggestion in autocompleteResult.Success.Suggestions)
      {
          var getResult = await api.Get(suggestion);

          if (getResult.IsSuccess)
          {
              var address = getResult.Success;
              var line1 = address.Line1;
              var line2 = address.Line2;
              var line3 = address.Line3;
              var line4 = address.Line4;
              var buildingName = address.BuildingName;
              //....
          }
      }
  }
  else
  {
      var errorMessage = autocompleteResult.Failed.Message;
  }
}
Top