pvWay.IpApi.Core 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package pvWay.IpApi.Core --version 2.0.0                
NuGet\Install-Package pvWay.IpApi.Core -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="pvWay.IpApi.Core" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pvWay.IpApi.Core --version 2.0.0                
#r "nuget: pvWay.IpApi.Core, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install pvWay.IpApi.Core as a Cake Addin
#addin nuget:?package=pvWay.IpApi.Core&version=2.0.0

// Install pvWay.IpApi.Core as a Cake Tool
#tool nuget:?package=pvWay.IpApi.Core&version=2.0.0                

IpApi nuGet by pvWay

Provides geolocalization info for a given ip. This service is based on IpStack API.

You'll need a valid IpStack API key to use this nuGet service.

Ip Stack offers a free API key that enables up to 10.000 requests per month.

Susbscribe here https://ipstack.com/product for getting your free API key

Usage

Constructor
	
    // replace '****...' with your own key
    var localizer = new Localizer("*********************************");

Localize

	
    var localize = localizer.LocalizeAsync("109.88.95.155").Result;
    if (localize.Failure)
    {
    	Console.WriteLine(localize.Exception);
    }
    else
    {
        var loc = localize.Data;
        Console.WriteLine(loc.City);
    }

Interfaces
	
    public interface ILocalizer
    {
        Task<<ILocalizerResult>> LocalizeAsync(string ip);
    }
    
    public interface ILocalizerResult
    {
        bool Success { get; }
        bool Failure { get; }
        Exception Exception { get; }
        ILocalization Data { get; }
    }

    public interface ILocalization
    {
        string Ip { get; }
        string HostName { get; }
        string Type { get; }
        string ContinentCode { get; }
        string ContinentName { get; }
        string CountryCode { get; }
        string CountryName { get; }
        string RegionCode { get; }
        string RegionName { get; }
        string City { get; }
        string Zip { get; }
        double Latitude { get; }
        double Longitude { get; }
        ILocation Location { get; } // free plan
        ITimeZone TimeZone { get; } // as from basic plan
        ICurrency Currency { get; } // as from basic plan
        IConnection Connection { get; } // as from basic plan
        ISecurity Security { get; } // as from basic plan
    }
 
    public interface ILocation
    {
        int GeoNameId { get; }
        string Capital { get; }
        IEnumerable<ILanguage> Languages { get; }
        string CountryFlagUrl { get; }
        string CountryFlagEmoji { get; }
        string CountryFlagEmojiUnicode { get; }
        string CallingCode { get; }
        bool EuroMember { get; }
    }
 
    public interface ILanguage
    {
        string Code { get; }
        string Name { get; }
        string Native { get; }
    }
    
    public interface ITimeZone
    {
        string Id { get; }
        DateTime CurrentTime { get; }
        int GmtOffset { get; }
        string Code { get; }
        bool IsDayLightSaving { get; }
    }

	public interface ICurrency
    {
        string Code { get; }
        string Name { get; }
        string Plural { get; }
        string Symbol { get; }
        string SymbolNative { get; }
    }
    
    public interface IConnection
    {
        string Asn { get; }
        string Isp { get; }
    }

    public interface ISecurity
    {
        bool IsProxy { get; }
        string ProxyType { get; }
        bool IsCrawler { get; }
        string CrawlerName { get; }
        string CrawlerType { get; }
        bool IsTor { get; }
        string ThreatLevel { get; }
        string ThreatTypes { get; }
    }

Happy coding !

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.2 484 7/12/2022
3.0.1 600 3/5/2021
3.0.0 340 3/5/2021
2.0.0 571 9/19/2020
1.0.0 476 6/8/2020

breaking change: clear dependency with pvWayMethodResult