Rendez-vous (MultiServiceAppointment)
Le module MultiServiceAppointmentModule gère la prise de rendez-vous pour les services. Il permet de créer, lister et gérer le cycle de vie des rendez-vous.
Accès : client.app.multiService.appointment
Statuts de rendez-vous
| Statut | Description |
|---|---|
PENDING | Rendez-vous créé, en attente de confirmation |
CONFIRMED | Rendez-vous confirmé par l’entreprise |
IN_PROGRESS | Rendez-vous en cours |
COMPLETED | Rendez-vous terminé |
CANCELLED | Rendez-vous annulé |
Méthodes
create
Crée un nouveau rendez-vous.
Exemple
const response = await client.app.multiService.appointment.create({
appId: "app_id",
apiKey: "user_api_key",
serviceId: "service_id",
customerId: "customer_id",
date: new Date("2025-01-15T10:00:00Z"),
totalPrice: 5000,
commune: "Cocody",
filledFields: {
"type_coupe": "degrade",
"commentaires": "Coupe courte sur les côtés"
},
agentId: "agent_id", // Optionnel
});list
Liste les rendez-vous avec filtres optionnels.
Exemple
// Lister tous les rendez-vous
const all = await client.app.multiService.appointment.list({
appId: "app_id",
apiKey: "user_api_key"
});
// Filtrer par statut
const pending = await client.app.multiService.appointment.list({
appId: "app_id",
apiKey: "user_api_key",
status: "PENDING"
});
// Filtrer par service
const byService = await client.app.multiService.appointment.list({
appId: "app_id",
apiKey: "user_api_key",
serviceId: "service_id"
});
// Combiner les filtres
const filtered = await client.app.multiService.appointment.list({
appId: "app_id",
apiKey: "user_api_key",
companyId: "company_id",
serviceId: "service_id",
status: "CONFIRMED"
});get
Récupère les détails d’un rendez-vous spécifique.
Exemple
const response = await client.app.multiService.appointment.get({
appId: "app_id",
apiKey: "user_api_key",
id: "appointment_id"
});
if (response.success) {
const apt = response.data;
console.log(`Rendez-vous: ${apt.service.name}`);
console.log(`Date: ${apt.date}`);
console.log(`Statut: ${apt.status}`);
console.log(`Agent: ${apt.agent?.fullname ?? 'Non assigné'}`);
}updateStatus
Met à jour le statut d’un rendez-vous. C’est la seule façon de modifier un rendez-vous après sa création.
Exemple
// Confirmer un rendez-vous
const confirmed = await client.app.multiService.appointment.updateStatus({
appId: "app_id",
apiKey: "user_api_key",
id: "appointment_id",
status: "CONFIRMED"
});
// Marquer comme en cours
const inProgress = await client.app.multiService.appointment.updateStatus({
appId: "app_id",
apiKey: "user_api_key",
id: "appointment_id",
status: "IN_PROGRESS"
});
// Terminer le rendez-vous
const completed = await client.app.multiService.appointment.updateStatus({
appId: "app_id",
apiKey: "user_api_key",
id: "appointment_id",
status: "COMPLETED"
});
// Annuler un rendez-vous
const cancelled = await client.app.multiService.appointment.updateStatus({
appId: "app_id",
apiKey: "user_api_key",
id: "appointment_id",
status: "CANCELLED"
});Flux de travail typique
Création du rendez-vous
Le client crée un rendez-vous avec le statut initial PENDING.
Confirmation
L’entreprise confirme le rendez-vous → statut CONFIRMED.
Début de la prestation
L’agent commence le service → statut IN_PROGRESS.
Fin de la prestation
Le service est terminé → statut COMPLETED.
// Exemple de flux complet
async function appointmentWorkflow(appointmentId: string) {
const params = { appId: "app_id", apiKey: "api_key", id: appointmentId };
// 1. Confirmer
await client.app.multiService.appointment.updateStatus({
...params,
status: "CONFIRMED"
});
// 2. Démarrer
await client.app.multiService.appointment.updateStatus({
...params,
status: "IN_PROGRESS"
});
// 3. Terminer
await client.app.multiService.appointment.updateStatus({
...params,
status: "COMPLETED"
});
}Gestion des erreurs
| Code erreur | Description |
|---|---|
appointment-not-found | Le rendez-vous n’existe pas ou n’appartient pas à l’entreprise |
service-not-found | Le service spécifié n’existe pas |
agent-not-found | L’agent spécifié n’existe pas ou n’appartient pas à l’entreprise |
not-authorized | La clé API n’a pas les droits nécessaires |
Last updated on