Skip to content

closelink/closelink-api-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloselinkAPI

.NET API Wrapper for the Closelink API (http://developer.closelink.com)

Installation

Package Manger
Install-Package CloselinkAPI
.NET CLI
dotnet add package CloselinkAPI

Import the following namespaces:

using CloselinkAPI.Api;
using CloselinkAPI.Client;
using CloselinkAPI.Model;

Getting Started

using System;
using System.Collections.Generic;
using CloselinkAPI.Api;
using CloselinkAPI.Client;
using CloselinkAPI.Model;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            // Configure API key authorization
            Configuration.Default.ApiKey = "YOUR_API_KEY";

            var apiInstance = new StockApi();
            var stocks = new List<Stock>
            {
                new Stock(
                    "imo1",
                    DateTime.Parse("2020-08-01T00:00:00.000Z"),
                    5000,
                    Stock.OilTypeEnum.AeCirc
                ),
                new Stock(
                    "imo1",
                    DateTime.Parse("2020-08-01T00:00:00.000Z"),
                    7000,
                    Stock.OilTypeEnum.MeCylHs
                )
            };

            try
            {
                // Creates new Stock data
                ApiResponse<List<Stock>> response = apiInstance.Create(stocks);
                Console.WriteLine("StatusCode: " + response.StatusCode);
                var stockResult = response.Data;
                stockResult.ForEach(Console.WriteLine);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling StockApi.Create: " + e.Message);
            }
        }
    }
}

Documentation for API Endpoints

Documentation for Models

Documentation for Authorization

apikey

  • Type: API key
  • API key parameter name: apikey
  • Location: HTTP header

Notes

The code is mainly generated by https://github.com/swagger-api/swagger-codegen.git and then simplified for this usecase.