npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

prhfi-bis

v1.0.0

Published

A small wrapper of Finnish Patent and Registration Office BIS v1 api

Downloads

12

Readme

prhfi-bis

a small wrapper of Finnish Patent and Registration Office BIS v1 api
original document for the API => avoindata.prh.fi

Table of Contents

  1. How to Install
  2. API functions
  3. Helper Function

install

install from npm:

$> npm i profi-bis

git & build:

$> git clone https://github.com/kkuzar/prhfi-bis.git
$> cd prhfi-bis 
$> npm run build

test build:

$> npm test

init

construct the new class:

import {BisApi} from 'prhfi-bis'
// or using require

// input options here, if null then use default.
let bisapi = new BisApi()  

default options:

const defaultOptions: BisConfig = {
    hostname: "avoindata.prh.fi",
    port: 443,
    path: "/bis/v1",
    method: "GET",
    protocol: "https"
};

// this class can take any config in this format

API Functions

Full Wrapper for Bis v1 API.

fetch by Business Id getCompanyDetailWithBusinessId(intput: string)

fetch Company Full Detail with Finnish Business Id

 let bis = new BisApi();
 const res = await bis.getCompanyDetailWithBusinessId("2299022-8");

this function will return a detail JSON as BIS website shows.

fetch using query param getCompanyDetailWithQueryParam(inputObj: object)

let bis = new BisApi();
const res = await bis.getCompanyDetailWithQueryParam({
    name: "KES",
    companyRegistrationFrom: "1999-01-01",
});

this function will return a detail JSON as BIS website shows. This if the query is detail enough this function will return one full detail other wise it will return a list of potential company, more detail on BIS document in above link.

e.g.

{
  "type": "fi.prh.opendata.bis",
  "version": "1",
  "totalResults": -1,
  "resultsFrom": 0,
  "previousResultsUri": null,
  "nextResultsUri": "http://avoindata.prh.fi/opendata/bis/v1?totalResults=false&maxResults=10&resultsFrom=10&name=KES&companyRegistrationFrom=2014-02-28",
  "exceptionNoticeUri": null,
  "results": [
    {
      "businessId": "3114031-3",
      "name": "Kestimestarit Oy",
      "registrationDate": "2020-01-24",
      "companyForm": "OY",
      "detailsUri": "http://avoindata.prh.fi/opendata/bis/v1/3114031-3"
    },
    {
      "businessId": "3109375-6",
      "name": "Kesar Oy",
      "registrationDate": "2020-01-07",
      "companyForm": "OY",
      "detailsUri": "http://avoindata.prh.fi/opendata/bis/v1/3109375-6"
    },
    ...
  ]
}

Custom JSON return

// Custom return body format
protected initStructedCompanyInfomation(): StructedCompanyInfomation {
        return {
            name: null,
            businessId: null,
            companyForm: null,
            website: null,
            latestAddr: null,
            latestPost: null,
            latestCity: null,
            latestBusinessCode: null,
            latestBusinessLine: null,
            latestAuxiliaryNames: null,
        }
    }

the return value will be StructedCompanyInfomation or array of it StructedCompanyInfomation[]

fetch Company Brief Structed Information with Business ID getCompanyWithBID(inputObj: object)

 let bis = new BisApi();
 const res = await bis.getCompanyWithBID("2299022-8");

fetch Company Brief Structed Information with Params getCompanyWithParam(inputObj: object)

let bis = new subject.BisApi();
const res = await bis.getCompanyWithParam({
    name: "Kesäturva Oy",
    companyRegistrationFrom: "1999-01-01",
});

example return for Structed Information:

[
  {
    name: 'Suomen Ajoneuvotekniikka Oy',
    businessId: '3099016-4',
    companyForm: 'OY',
    website: '0400643313',
    latestAddr: 'Marjahaankierto 2-4',
    latestPost: 'IISALMI',
    latestCity: null,
    latestBusinessCode: '45112',
    latestBusinessLine: 'Retail sale of cars and light motor vehicles',
    latestAuxiliaryNames: 'Keski-Suomen Rengas'
  },
  {
    name: 'Kestävä Kollektiivi Oy',
    businessId: '3093045-2',
    companyForm: 'OY',
    website: 'www.kestava.net',
    latestAddr: 'Husares 1853, depto 302 1428   CABA ARGENTINA',
    latestPost: null,
    latestCity: null,
    latestBusinessCode: '71121',
    latestBusinessLine: 'Town and city planning',
    latestAuxiliaryNames: ''
  },
  ...
]

Helper Functions

Assemble a company Request Query With Object that has same key typeQueryBody(inputObj: object)

example code snippet

 let bis = new BisApi();
 let res = bis.typeQueryBody({
     name: "KES",
     companyRegistrationFrom: "1999-01-01",
     companyForm: "OY"
 });

This helper will return a query object type has strutrue as following:

 protected initBisCompanyDetailQueryObject() {
        let res: BisRequestQueryDetail = {
            totalResults: "false",
            maxResults: "10",
            resultsFrom: "0",
            name: "",
            businessId: "",
            registeredOffice: "",
            streetAddressPostCode: "",
            companyForm: "",
            businessLine: "",
            businessLineCode: "",
            companyRegistrationFrom: "",
            companyRegistrationTo: ""
        };
        return res;
    }

For now it will only validate the companyForm , companyRegistrationFrom, companyRegistrationTo.