Agents (MultiServiceAgent)
Le module MultiServiceAgentModule permet de gérer le personnel (agents) qui effectue les services. Les agents peuvent être associés à plusieurs services et sont affectés aux rendez-vous.
Accès : client.app.multiService.agent
Méthodes
create
Crée un nouvel agent.
Exemple
const response = await client.app.multiService.agent.create({
appId: "app_id",
apiKey: "user_api_key",
fullname: "Alice Kouassi",
email: "alice@salon.com",
telephone: "+2250505050505",
bio: "Coiffeuse professionnelle avec 5 ans d'expérience",
photo: "https://example.com/alice.jpg",
photoId: "photo_file_id",
companyId: "company_id", // Optionnel
serviceIds: ["service_id_1", "service_id_2"],
isActive: true
});list
Liste les agents avec filtres optionnels.
Exemple
// Lister tous les agents
const all = await client.app.multiService.agent.list({
appId: "app_id",
apiKey: "user_api_key"
});
// Filtrer par service
const byService = await client.app.multiService.agent.list({
appId: "app_id",
apiKey: "user_api_key",
serviceId: "service_id"
});
// Filtrer par statut actif
const activeOnly = await client.app.multiService.agent.list({
appId: "app_id",
apiKey: "user_api_key",
isActive: true
});
// Combiner les filtres
const filtered = await client.app.multiService.agent.list({
appId: "app_id",
apiKey: "user_api_key",
serviceId: "service_id",
isActive: true
});get
Récupère les détails d’un agent.
Exemple
const response = await client.app.multiService.agent.get({
appId: "app_id",
apiKey: "user_api_key",
id: "agent_id"
});
if (response.success) {
const agent = response.data;
console.log(`Agent: ${agent.fullname}`);
console.log(`Services: ${agent.services.map(s => s.name).join(', ')}`);
}update
Met à jour les informations d’un agent.
Exemple
// Mise à jour du profil
const response = await client.app.multiService.agent.update({
appId: "app_id",
apiKey: "user_api_key",
id: "agent_id",
fullname: "Alice K.",
bio: "Spécialiste coloration et coupe"
});
// Désactiver un agent
const response2 = await client.app.multiService.agent.update({
appId: "app_id",
apiKey: "user_api_key",
id: "agent_id",
isActive: false
});
// Mettre à jour les services assignés
const response3 = await client.app.multiService.agent.update({
appId: "app_id",
apiKey: "user_api_key",
id: "agent_id",
serviceIds: ["service_id_1", "service_id_3", "service_id_4"]
});delete
Supprime un agent.
Exemple
const response = await client.app.multiService.agent.delete({
appId: "app_id",
apiKey: "user_api_key",
id: "agent_id"
});
if (response.success) {
console.log("Agent supprimé avec succès");
}Exemples d’utilisation
Créer un agent avec tous les services
// Récupérer tous les services de l'entreprise
const services = await client.app.multiService.service.list({
appId: "app_id",
apiKey: "user_api_key"
});
// Créer un agent polyvalent
const agent = await client.app.multiService.agent.create({
appId: "app_id",
apiKey: "user_api_key",
fullname: "Jean Dupont",
serviceIds: services.data.map(s => s.id)
});Trouver des agents disponibles pour un service
// Agents actifs pour un service spécifique
const agents = await client.app.multiService.agent.list({
appId: "app_id",
apiKey: "user_api_key",
serviceId: "service_id",
isActive: true
});
console.log(`${agents.data.length} agent(s) disponible(s)`);Gestion des erreurs
| Code erreur | Description |
|---|---|
agent-not-found | L’agent n’existe pas ou n’appartient pas à l’entreprise |
not-authorized | La clé API n’a pas les droits nécessaires |
app-not-found | L’application n’existe pas |
Last updated on