@kelvininc/node-client-sdk
v8.16.0
Published
Kelvin SDK Client for Node applications
Downloads
152
Readme
Node Getting Started
Requirements
The kelvin SDK needs to support the following versions:
- NodeJS: 8.0+
Installation
Install the Kelvin Node SDK library inside your project
npm install @kelvininc/node-client-sdk --saveTypeScript Configuration
If you're using TypeScript, you need to include the DOM library in your tsconfig.json compiler options:
{
"compilerOptions": {
"lib": ["ES2020", "DOM"]
}
}Why is this required?
This SDK is part of a monorepo that provides client adapters for both web browsers and Node.js. The core SDK (@kelvininc/js-client-sdk) uses DOM types like Blob, FormData, and Headers for browser compatibility, which are inherited by the Node SDK.
Note for Next.js users: Next.js projects already include DOM libs by default, so no additional configuration is needed.
Alternative: If you prefer not to add DOM libs, you can use "skipLibCheck": true in your tsconfig.json, though this is generally not recommended as it disables type checking for all declaration files.
Getting Started
Import Kelvin inside your project
const Kv = require('@kelvininc/node-client-sdk');
// or, if you are using es module
import { KelvinSDK } from '@kelvininc/node-client-sdk';After that, it's important to initialize the SDK with the correct information to make available our API methods.
KelvinSDK.initialize({
baseUrl: '<base-url-of-you-company>',
authConfig: {
clientId: '<client-id>',
realm: '<realm>',
url: '<authentication-url>'
}
});Usage
Follow some examples of services usage.
Login Process
import { AuthService } from '@kelvininc/node-client-sdk';
AuthService.login({
username: '<username or email>',
password: '<password>'
}).subscribe(({ accessToken, refreshToken }) => doSomething());Get a list of ACPs
import { ACPService } from '@kelvininc/node-client-sdk';
ACPService.listACP({
pageSize: 20
}).subscribe(acpList => doSomething(acpList));Kelvin SDK Client API Documentation
You can find the full Client API reference here.
