pvWay.IpApi.nc6 1.0.0

dotnet add package pvWay.IpApi.nc6 --version 1.0.0                
NuGet\Install-Package pvWay.IpApi.nc6 -Version 1.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.nc6" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pvWay.IpApi.nc6 --version 1.0.0                
#r "nuget: pvWay.IpApi.nc6, 1.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.nc6 as a Cake Addin
#addin nuget:?package=pvWay.IpApi.nc6&version=1.0.0

// Install pvWay.IpApi.nc6 as a Cake Tool
#tool nuget:?package=pvWay.IpApi.nc6&version=1.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 net6.0 is compatible.  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. 
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
1.0.0 653 7/12/2022

initial nc6 version