@ksthiru/facts v1.0.0
Facts SDK for NodeJS
The Facts SDK is a simple and powerful REST API to manage shared knowledge. The SDK bundles Bleumi Pay API into one SDK to ease implementation and support.
Getting Started
The Facts SDK for NodeJS bundles TypeScript definition files for use in TypeScript projects and to support tools that can read .d.ts files. Our goal is to keep these TypeScript definition files updated with each release for any public api.
Pre-requisites
Before you can begin using these TypeScript definitions with your project, you need to make sure your project meets a few of these requirements:
Development Environment
- Use TypeScript v2.x
Includes the TypeScript definitions for node. You can use npm to install this by typing the following into a terminal window:
npm install --save-dev @types/node
If you are targeting at es5 or older ECMA standards, your
tsconfig.json
has to include'es5'
and'es2015.promise'
undercompilerOptions.lib
. See tsconfig.json for an example.
Obtain An API Key
Bleumi Pay SDK uses API keys to authenticate requests. You can obtain an API key through the (https://thirupathy.me/facts/app/).
Install Package
In Node.js
npm install facts-sdk-nodejs -g
Run Sample Code
The following code gets an entity given the ID.
import { EntitiesApi, EntitiesApiApiKeys } from './api/entitiesApi';
// Instantiate clients
const facts = new EntitiesApi();
async function getWallet(id: string) {
try {
facts.setApiKey(EntitiesApiApiKeys.ApiKeyAuth, '<YOUR_API_KEY>')
const response = await facts.getEntity(id);
const wallet = response.body;
console.log(JSON.stringify(wallet));
} catch (err) {
console.error('Error statusCode:', err.response.statusCode);
console.error('Error reponse:', err.response.body);
}
}
getWallet("<ID>");
Documentation for API Endpoints
Class | Method | HTTP request | Description |
---|---|---|---|
EntitiesApi | createEntity | POST /api/v1/entity | Create an entity |
EntitiesApi | getEntity | GET /api/v1/entity/{id} | Return a specific entity |
EntitiesApi | listEntities | GET /api/v1/entity | Returns a list of entities |
Documentation for Models
Documentation for Authorization
Authentication schemes defined for the API:
ApiKeyAuth
- Type: API key
- API key parameter name: x-api-key
- Location: HTTP header
Recommendation
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.
Author
info@thirupathy.me
4 years ago