All Projects → kevbite → CompaniesHouse.NET

kevbite / CompaniesHouse.NET

Licence: MIT License
A simple .NET client wrapper for CompaniesHouse API

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to CompaniesHouse.NET

GenomicDataCommons
Provide R access to the NCI Genomic Data Commons portal.
Stars: ✭ 64 (+128.57%)
Mutual labels:  api-client
go-amazon-product-advertising-api
Go Client Library for Amazon Product Advertising API
Stars: ✭ 51 (+82.14%)
Mutual labels:  api-client
ynab.go
Go client for the YNAB API. Unofficial. It covers 100% of the resources made available by the YNAB API.
Stars: ✭ 49 (+75%)
Mutual labels:  api-client
siteleaf-node
Node library for Siteleaf v2 API
Stars: ✭ 14 (-50%)
Mutual labels:  api-client
openweathermap-java-api
Java API to access openweathermap.org API
Stars: ✭ 19 (-32.14%)
Mutual labels:  api-client
fetch
Isomorphic Wordpress API client and React hooks - super tiny, super fast.
Stars: ✭ 47 (+67.86%)
Mutual labels:  api-client
ContextIO-node
[DEPRECATED] - Official Node.js client library for the Context.IO Email API
Stars: ✭ 86 (+207.14%)
Mutual labels:  api-client
pushover
Go wrapper for the Pushover API
Stars: ✭ 112 (+300%)
Mutual labels:  api-client
wiesbaden
Client to Access Databases from the Federal Statistical Office of Germany (DESTATIS)
Stars: ✭ 32 (+14.29%)
Mutual labels:  api-client
simple-php-api
An extremely simple API (with authentication) example, written in PHP (server) and JS (client), using JSON
Stars: ✭ 23 (-17.86%)
Mutual labels:  api-client
purescript-swerve
Swerve is a library that offers a type-level DSL for describing server and client web applications. Inspired by Haskell's Servant library.
Stars: ✭ 20 (-28.57%)
Mutual labels:  api-client
radiobrowser4j
RadioBrowser Java API library
Stars: ✭ 30 (+7.14%)
Mutual labels:  api-client
nodejs-searchitunes
Lightweight node.js module to quickly search Apple's iTunes Store for music, movies, apps, etc.
Stars: ✭ 25 (-10.71%)
Mutual labels:  api-client
poloniex-api
ARCHIVED --- A Go wrapper to the Poloniex API
Stars: ✭ 15 (-46.43%)
Mutual labels:  api-client
mite-cli
command line interface for time tracking service mite.yo.lk
Stars: ✭ 17 (-39.29%)
Mutual labels:  api-client
go-kkbox
KKBOX Open API SDK for Golang.
Stars: ✭ 16 (-42.86%)
Mutual labels:  api-client
cv4pve-api-dotnet
Proxmox VE Client API .Net C#
Stars: ✭ 25 (-10.71%)
Mutual labels:  api-client
pocket-api
A python wrapper around GetPocket API V3.
Stars: ✭ 103 (+267.86%)
Mutual labels:  api-client
nzb
Get Things Done® with nzb, a beautiful terminal interface for Nozbe. Inspired by Wunderline
Stars: ✭ 35 (+25%)
Mutual labels:  api-client
Taviloglu.Wrike.ApiClient
.NET Client for Wrike API
Stars: ✭ 24 (-14.29%)
Mutual labels:  api-client

CompaniesHouse.NET

A simple .NET client wrapper for CompaniesHouse API.

install from nuget downloads Build status

Getting Started

CompaniesHouse.NET can be installed via the package manager console by executing the following commandlet:

PM> Install-Package CompaniesHouse

Once we have the package installed, we can then create a CompaniesHouseSettings with a ApiKey which can be created via the CompaniesHouse API website

var settings = new CompaniesHouseSettings(apiKey);

We need to now create a CompaniesHouseClient - passing in the settings that we've just created.

using(var client = new CompaniesHouseClient(settings))
{
    // Do some work...
}

This is the object we'll use going forward for any interaction to the CompaniesHouse API, but don't forget to call Dispose after you've finish (or wrap in a using block).

ASP.NET Core

If you're using ASP.NET Core you can configure the IoC container with one simple extention method call. But first you'll need to install the CompaniesHouse.Extensions.Microsoft.DependencyInjection NuGet package.

PM> Install-Package CompaniesHouse.Extensions.Microsoft.DependencyInjection

Once installed, in your Startup class in the ConfigureServices method, call the AddCompaniesHouseClient method on the services object.

public void ConfigureServices(IServiceCollection services)
{
    // ...
    services.AddCompaniesHouseClient("Your API Key");
}

This will then register a range of interfaces in to the IoC container that can be injected in to any of your dependancies. A list of these can be found in the ServiceCollectionExtensionsTests.

For example if we wanted to use the ICompaniesHouseClient which is the main facade interface, we could inject this in to our page model.

public class MyPageModel : PageModel
{
    private readonly ICompaniesHouseClient _client;

    public Index2Model(ICompaniesHouseClient client)
    {
        _client = client;            
    }
}

Under the hood this is using typed clients for the HttpClient used by CompaniesHouse.NET and it's also possible to use this package with any dependency injection framework that implements Microsoft.Extensions.DependencyInjection.Abstractions.

Usage

Searching for resources

To search for a resource, we first need to create a SearchRequest with details of the search we require.

var request = new SearchRequest()
{
    Query = "Jay2Base",
    StartIndex = 10,
    ItemsPerPage = 10
};

We can then pass the SearchRequest object in to the SearchAllAsync method and await on the task, this will then return all related resources.

var result = await client.SearchAllAsync(request);

foreach (var item in _result.Data.Items)
{
    // Do something...
}

If we need to be more precise on the resources we require, we can then pass the request object in to the required search method, either SearchCompanyAsync or SearchOfficerAsync or SearchDisqualifiedOfficerAsync and await on the task.

var result1 = await client.SearchCompanyAsync(request);

var result2 = await client.SearchOfficerAsync(request);

var result3 = await client.SearchDisqualifiedOfficerAsync(request);

Getting a company profile

To get a company profile, we pass a company number in to the GetCompanyProfileAsync method and await on the task.

var result = await client.GetCompanyProfileAsync("10440441");

If there was no match for that company number then null will be returned.

Getting company officer list

To get a list of officers for a company, we pass a company number in to the GetOfficersAsync method and await on the task.

var result = await client.GetOfficersAsync("03977902");

We can also pass in some optional parameters of startIndex and pageSize which will allow us to page the results.

var result = await client.GetOfficersAsync("03977902", 10, 10);

Getting company filing history list

To get a list of the filing history for a company, we can pass a company number to the GetCompanyFilingHistoryAsync method and await on the task.

var result = await client.GetCompanyFilingHistoryAsync("10440441");

We can also pass in some optional parameters of startIndex and pageSize which will allow us to page the results.

var result = await client.GetCompanyFilingHistoryAsync("10440441", 10, 10);

Getting company insolvency information

To get the insolvency information for a company, we can pass a company number to the GetCompanyInsolvencyInformationAsync method and await on the task.

var result = await client.GetCompanyInsolvencyInformationAsync("10440441");

If there was no insolvency information for the given company number then null will be returned.

Getting document metadata information

To get the metadata for a document, we can pass document id to the GetDocumentMetadataAsync method and await on the task.

var result = await client.GetDocumentMetadataAsync("FIxRR8teCKodjkBLRDHv2Cb8y0-nQ7T5G3BEXfWtOu4");

If there was no document metadata for the given document id then null will be returned.

Downloading a document

To download a document, we can pass document id to the DownloadDocumentAsync method and await on the task.

var result = await client.DownloadDocumentAsync("FIxRR8teCKodjkBLRDHv2Cb8y0-nQ7T5G3BEXfWtOu4");

If there was no document for the given document id then null will be returned.

Contributing

  1. Fork
  2. Hack!
  3. Pull Request

Running Unit tests

In order for the integration tests to run, you need an API Key from CompaniesHouse API website Setup API Key in an environment variable called "api_key", and then run the tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].