1.0.4 โข Published 8 months ago
@liga-api-sdk/core v1.0.4
LIGA GAME API SDK @liga-api-sdk/core
โก TypeScript SDK for integrating with the Liga backend APIs with built-in mock mode for frontend development and testing.
โจ Features
- ๐ Plug-and-play integration โ Ready-to-use methods to connect with Liga backend APIs
- ๐งช Built-in mock mode โ Develop mock api response features without needing a backend
- โก Modern TypeScript โ Fully typed methods and models with intellisense support
- ๐ก Access token injection โ Automatically sends JWT tokens in every request
- ๐ง Smart API switching โ Dynamically uses mock or real endpoints via global config
- ๐งพ Error handling & typing โ Clean API error responses with rich type safety
- ๐ช Developer-friendly logging โ Optional
developerModefor enhanced debugging and logs
๐ฆ Installation
npm add --save @liga-api-sdk/core๐ Quick Start & Example Usage
- Configure the SDK
import { configureSdk } from '@liga-api-sdk/core';
configureSdk({
useMock: false, // toggle mock mode (true = no backend required)
baseURL: 'https://api.liga.com',
accessToken: 'your-jwt-access-token', // optional if using cookies
});- Simple Login
import { AuthService } from '@liga-api-sdk/core';
const response = await AuthService.login({
username: 'johndoe',
password: 'MySecurePass!',
tenant_id: 'tenant-uuid-123',
device_id: 'device-uuid-xyz',
device_name: "John's MacBook",
device_type: 'desktop',
client_version: '1.0.0',
});
if ('access_token' in response) {
console.log('Logged in successfully:', response.user.username);
} else if (response.mfa_required) {
console.log('MFA required, temporary token:', response.temporary_token);
}๐ API REFERENCES
You can see the api lists from here API Swagger Document v1.0
Used By
This project is used by the following companies:
- Liga Game Company