1.0.4 โ€ข Published 8 months ago

@liga-api-sdk/core v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

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 developerMode for 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

Authors

1.0.4

8 months ago

1.0.5

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.0

8 months ago