Skip to content

objectia/objectia-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

objectia-csharp

Build Status

C#/.NET client for Objectia API®

Documentation

See the C# API docs.

Requirements

The C# client for Objectia API requires .NET Core 3.0 or later to be installed. You can check if you already have .NET Core installed on your machine by opening up a command prompt or terminal and running the following command:

dotnet --version

You should see something like 3.0.100. If you receive an error message, you can download .NET Core from Microsoft and install it.

Installation

With .NET CLI

dotnet add package Objectia --version 1.0.0

With Package Manager

PM> Install-Package Objectia -Version 1.0.0

Usage

The library needs to be configured with your account's API key. Get your own API key by signing up for a free Objectia account.

using System;
using Objectia;
using Objectia.Api;
using Objectia.Exceptions;

class Program 
{
    static void Main(string[] args)
    {
        var apiKey = Environment.GetEnvironmentVariable("OBJECTIA_APIKEY");
        try 
        {
            ObjectiaClient.Init(apiKey);
            var location = await Api.GeoLocation.Get("8.8.8.8"); 
            Console.WriteLine("Country code: " + location.CountryCode);
        } catch (ResponseException e) {
            Console.WriteLine("Failed to get location");
        }
    }
}

License and Trademarks

Copyright (c) 2018-19 UAB Salesfly.

Licensed under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Objectia is a registered trademark of UAB Salesfly.

About

C#/.NET client for Objectia API

Resources

License

Stars

Watchers

Forks

Packages

No packages published