@applite/js-sdk
v0.0.18
Published
A comprehensive JavaScript/TypeScript SDK for interacting with the Applite API. This library provides a typed interface to manage application data, e-commerce operations, service bookings, and more.
Readme
@applite/js-sdk
A comprehensive JavaScript/TypeScript SDK for interacting with the Applite API. This library provides a typed interface to manage application data, e-commerce operations, service bookings, and more.
Full Documentation: For detailed API references and guides, visit docs.appliteui.com.
Installation
pnpm add @applite/js-sdk
# or
npm install @applite/js-sdk
# or
yarn add @applite/js-sdkQuick Start
import { AppliteUI } from "@applite/js-sdk";
const client = new AppliteUI({
baseUrl: "https://api.applite.com", // Optional: Defaults to relative path
});
// Authenticate a customer
const user = await client.app.customer.auth({
appId: "app_123",
apiKey: "your_api_key",
fullname: "John Doe",
telephone: "+2250700000000",
});Core Concepts
Authentication
Every request requires two key parameters:
appId: The unique identifier of your applicationapiKey: The secret key used to authenticate requests
Method Signature
All SDK methods accept a single object containing all parameters:
await client.module.method({
appId: "...",
apiKey: "...",
...specificParams,
});Response Structure
// Success
{ success: true, data: {...} }
// Error
{ success: false, error: "message" }API Reference
Common Module (client.app)
Customer API (client.app.customer)
| Method | Description |
|--------|-------------|
| auth(params) | Authenticate or register a customer |
| check(params) | Check if a customer exists by phone |
| list(params) | List customers with optional filtering |
| get(params) | Get customer details by ID |
| update(params) | Update customer profile |
| block(params) | Block or unblock a customer |
| delete(params) | Delete a customer |
| selfDelete(params) | Customer self-deletion |
Info API (client.app.info)
| Method | Description |
|--------|-------------|
| list(params) | List all apps |
| create(params) | Create a new app |
| getBySlug(params) | Get app by slug |
| getById(params) | Get app by ID |
| update(params) | Update app details |
| updateModules(params) | Update app modules |
| toggleModule(params) | Toggle a module on/off |
Address API (client.app.address)
| Method | Description |
|--------|-------------|
| list(params) | List addresses |
| create(params) | Create an address |
| update(params) | Update an address |
| delete(params) | Delete an address |
| getById(params) | Get address by ID |
Testimony API (client.testimony)
| Method | Description |
|--------|-------------|
| create(params) | Admin: Create a testimony |
| list(params) | Admin: List testimonies with filters |
| getById(params) | Admin: Get testimony by ID |
| update(params) | Admin: Update a testimony |
| delete(params) | Admin: Delete a testimony |
| updateStatus(params) | Admin: Approve or reject testimony |
| submit(params) | Customer: Submit a new testimony |
| listPublic(params) | Public: Get approved testimonies |
Stats API (client.app.stats)
| Method | Description |
|--------|-------------|
| create(params) | Create a statistic entry |
| get(params) | Get statistic value |
Finance API (client.app.finance)
| Method | Description |
|--------|-------------|
| balance(params) | Get account balance |
| listTransactions(params) | List transactions |
Welcome Item API (client.app.welcomeItem)
| Method | Description |
|--------|-------------|
| list(params) | List welcome items |
| create(params) | Create a welcome item |
| update(params) | Update a welcome item |
| delete(params) | Delete a welcome item |
User API (client.user)
| Method | Description |
|--------|-------------|
| signup(params) | Register a new user |
| signin(params) | Sign in a user |
| get(params) | Get user by ID |
| update(params) | Update user profile |
| delete(params) | Delete a user |
| editCredentials(params) | Edit user credentials |
| verifyPassword(params) | Verify user password |
| setNotification(params) | Set notification preferences |
Notification Token API (client.app.notificationToken)
| Method | Description |
|--------|-------------|
| register(params) | Register a push token |
| unregister(params) | Unregister a push token |
Notification API (client.notification)
| Method | Description |
|--------|-------------|
| getFirebaseConfig(params) | Get Firebase config |
| setFirebaseConfig(params) | Set Firebase config |
| deleteFirebaseConfig(params) | Delete Firebase config |
| getTemplates(params) | Get notification templates |
| setTemplate(params) | Set a notification template |
| deleteTemplate(params) | Delete a notification template |
| getLogs(params) | Get notification logs |
Webhook API (client.webhook)
| Method | Description |
|--------|-------------|
| list(params) | List webhooks |
| set(params) | Create or update a webhook |
| delete(params) | Delete a webhook |
| getLogs(params) | Get webhook logs |
Store Module (client.app.store)
Product API (client.app.store.product)
| Method | Description |
|--------|-------------|
| list(params) | List products |
| create(params) | Create a product |
| get(params) | Get product by ID |
| update(params) | Update a product |
| delete(params) | Delete a product |
Order API (client.app.store.order)
| Method | Description |
|--------|-------------|
| list(params) | List orders |
| create(params) | Create an order |
| get(params) | Get order by ID |
| update(params) | Update an order |
Category API (client.app.store.category)
| Method | Description |
|--------|-------------|
| list(params) | List categories |
| create(params) | Create a category |
| get(params) | Get category by ID |
| update(params) | Update a category |
| delete(params) | Delete a category |
Badge API (client.app.store.badge)
| Method | Description |
|--------|-------------|
| list(params) | List badges |
| create(params) | Create a badge |
| update(params) | Update a badge |
| delete(params) | Delete a badge |
Collection API (client.app.store.collection)
| Method | Description |
|--------|-------------|
| list(params) | List collections |
| create(params) | Create a collection |
| get(params) | Get collection by ID |
| update(params) | Update a collection |
| delete(params) | Delete a collection |
Discount API (client.app.store.discount)
| Method | Description |
|--------|-------------|
| list(params) | List discounts |
| create(params) | Create a discount |
| get(params) | Get discount by ID |
| update(params) | Update a discount |
| delete(params) | Delete a discount |
| check(params) | Check discount validity |
Option API (client.app.store.option)
| Method | Description |
|--------|-------------|
| list(params) | List options |
| create(params) | Create an option |
| update(params) | Update an option |
| delete(params) | Delete an option |
Seller API (client.app.store.seller)
| Method | Description |
|--------|-------------|
| list(params) | List sellers |
| create(params) | Create a seller |
| get(params) | Get seller by ID |
| update(params) | Update a seller |
| delete(params) | Delete a seller |
Shipping API (client.app.store.shipping)
| Method | Description |
|--------|-------------|
| list(params) | List shipping profiles |
| create(params) | Create a shipping profile |
| update(params) | Update a shipping profile |
| delete(params) | Delete a shipping profile |
Tag API (client.app.store.tag)
| Method | Description |
|--------|-------------|
| list(params) | List tags |
| create(params) | Create a tag |
| update(params) | Update a tag |
| delete(params) | Delete a tag |
Tax API (client.app.store.tax)
| Method | Description |
|--------|-------------|
| list(params) | List tax configurations |
| create(params) | Create a tax configuration |
| update(params) | Update a tax configuration |
| delete(params) | Delete a tax configuration |
Multi-Service Module (client.app.multiService)
Company API (client.app.multiService.company)
| Method | Description |
|--------|-------------|
| list(params) | List companies |
| create(params) | Create a company |
| get(params) | Get company by ID |
| update(params) | Update a company |
| delete(params) | Delete a company |
Service API (client.app.multiService.service)
| Method | Description |
|--------|-------------|
| list(params) | List services |
| create(params) | Create a service |
| get(params) | Get service by ID |
| update(params) | Update a service |
| delete(params) | Delete a service |
Agent API (client.app.multiService.agent)
| Method | Description |
|--------|-------------|
| list(params) | List agents |
| create(params) | Create an agent |
| get(params) | Get agent by ID |
| update(params) | Update an agent |
| delete(params) | Delete an agent |
Appointment API (client.app.multiService.appointment)
| Method | Description |
|--------|-------------|
| list(params) | List appointments |
| create(params) | Create an appointment |
| get(params) | Get appointment by ID |
| updateStatus(params) | Update appointment status |
| assignAgent(params) | Assign an agent to appointment |
Field Template API (client.app.multiService.fieldTemplate)
| Method | Description |
|--------|-------------|
| list(params) | List field templates |
| create(params) | Create a field template |
| update(params) | Update a field template |
| delete(params) | Delete a field template |
Duticotac Module (client.duticotac)
Balance API (client.duticotac.balance)
| Method | Description |
|--------|-------------|
| get(params) | Get account balance |
Offer API (client.duticotac.offer)
| Method | Description |
|--------|-------------|
| list(params) | List offers |
| create(params) | Create an offer |
| get(params) | Get offer by ID |
| update(params) | Update an offer |
| delete(params) | Delete an offer |
Payment API (client.duticotac.payment)
| Method | Description |
|--------|-------------|
| initiate(params) | Initiate a payment |
| verify(params) | Verify a payment |
Transaction API (client.duticotac.transaction)
| Method | Description |
|--------|-------------|
| list(params) | List transactions |
| get(params) | Get transaction by ID |
Kolabo Module (client.kolabo)
App API (client.kolabo.app)
| Method | Description |
|--------|-------------|
| list(params) | List Kolabo apps |
| getBySlug(slug, params) | Get app by slug |
| get(slug, params) | Get app details |
| configure(slug, params) | Configure a Kolabo app |
| join(slug, params) | Join a Kolabo app |
Customer API (client.kolabo.customer)
| Method | Description |
|--------|-------------|
| list(params) | List customers |
| get(params) | Get customer by ID |
Partner API (client.kolabo.partner)
| Method | Description |
|--------|-------------|
| list(params) | List partners |
| create(params) | Create a partner |
| get(params) | Get partner by ID |
| update(params) | Update a partner |
Super Admin Module (client.superAdmin)
Auth API (client.superAdmin.auth)
| Method | Description |
|--------|-------------|
| init(params) | Initialize super admin |
| signin(params) | Sign in as super admin |
| me(params) | Get current admin info |
Apps API (client.superAdmin.apps)
| Method | Description |
|--------|-------------|
| list(params) | List all apps |
| get(params) | Get app by ID |
| update(params) | Update an app |
Modules API (client.superAdmin.modules)
| Method | Description |
|--------|-------------|
| list(params) | List all modules |
| update(params) | Update module settings |
Stats API (client.superAdmin.stats)
| Method | Description |
|--------|-------------|
| get(params) | Get platform statistics |
Finance API (client.superAdmin.finance)
| Method | Description |
|--------|-------------|
| balance(params) | Get platform balance |
| listTransactions(params) | List platform transactions |
Notification API (client.superAdmin.notification)
| Method | Description |
|--------|-------------|
| send(params) | Send a notification |
| broadcast(params) | Broadcast to all users |
Maintenance Module (client.maintenance)
| Method | Description |
|--------|-------------|
| cronNotification(params) | Run notification cron job |
| cronBilling(params) | Run billing cron job |
| cleanupTransactions(params) | Cleanup old transactions |
Error Handling
All API methods return a promise that resolves to a response object:
try {
const response = await client.app.customer.auth({
appId: "app_123",
apiKey: "your_api_key",
fullname: "John Doe",
telephone: "+2250700000000",
});
if (response.success) {
console.log("User:", response.data);
}
} catch (error) {
console.error("Request failed:", error);
}TypeScript Support
The SDK is written in TypeScript and ships with full type definitions:
import {
Customer,
CustomerListItem,
CustomerAuthParams,
CreateProductParams,
OrderStatus,
PaymentStatus,
// ... and many more
} from "@applite/js-sdk";Scripts
pnpm build # Build the SDK (ESM/CJS)
pnpm test # Run type checks