JavaScript SDK
Le SDK JavaScript Applite (@applite/js-sdk) vous permet d’interagir facilement avec l’API Applite depuis vos applications JavaScript et TypeScript.
Version actuelle: 0.0.2 | TypeScript: Natif
Installation
Installer le package
npm install @applite/js-sdk
# ou
pnpm add @applite/js-sdk
# ou
yarn add @applite/js-sdkInitialiser le client
import { AppliteUI } from "@applite/js-sdk";
const client = new AppliteUI({
baseUrl: "https://api.applite.ai", // Optionnel
});Configuration
| Option | Type | Description |
|---|---|---|
baseUrl | string? | URL de base de l’API (optionnel) |
headers | Record<string, string>? | Headers personnalisés |
fetchFn | typeof fetch? | Fonction fetch personnalisée |
Authentification
Toutes les requêtes nécessitent deux paramètres :
apiKey: Votre clé API secrèteappId: L’identifiant de votre application
const response = await client.app.customer.list({
appId: "votre_app_id",
apiKey: "votre_api_key",
});Structure du SDK
Le SDK est organisé en modules accessibles via client.app :
client.app
├── customer // Gestion des clients
├── info // Informations application
├── stats // Statistiques
├── finance // Solde et transactions
├── welcomeItem // Écrans d'accueil
├── store // Module e-commerce
│ ├── product
│ ├── category
│ ├── order
│ ├── seller
│ ├── badge
│ ├── collection
│ ├── discount
│ ├── option
│ ├── shipping
│ ├── tag
│ └── tax
└── multiService // Module services
├── company
├── service
├── agent
└── appointmentExemple rapide
import { AppliteUI } from "@applite/js-sdk";
const client = new AppliteUI({
baseUrl: "https://api.applite.ai"
});
// Lister les produits
const products = await client.app.store.product.list({
appId: "app_id",
apiKey: "api_key",
page: 1,
limit: 20
});
console.log(`${products.data.length} produits trouvés`);
// Créer un client
const customer = await client.app.customer.auth({
appId: "app_id",
apiKey: "api_key",
fullname: "Jean Dupont",
telephone: "+225070000000"
});
console.log(`Client créé: ${customer.data.id}`);Gestion des erreurs
try {
const product = await client.app.store.product.get({
appId: "app_id",
apiKey: "api_key",
id: "product_id"
});
} catch (error) {
if (error.message === "product-not-found") {
console.log("Produit non trouvé");
}
}Modules
Explorez la documentation détaillée de chaque module :
- Store (Boutique) - E-commerce complet (produits, commandes, vendeurs…)
- Multi-Service - Services et rendez-vous
Last updated on