diff --git a/README.md b/README.md index c6fbe552c45588ff838dcaf83ce2f25caf352a17..85b991fb3343b46ccf7ca9f19cd1b2c8d5fd8bff 100644 --- a/README.md +++ b/README.md @@ -760,8 +760,6 @@ Cet endpoint permet de créer une nouvelle partie et retourne ses détails. | quizId | string | Oui | Identifiant du quiz | | -------- | ------ | ------ | ------------------- | ---- - ### Exemple de requête ```json @@ -770,6 +768,134 @@ Cet endpoint permet de créer une nouvelle partie et retourne ses détails. } ``` ---- +### Exemple de réponse + +```json +{ + "id": "CH36SF", + "name": "New party", + "quizId": "SY91WN", + "status": "open" +} +``` + +# Documentation API: Rejoindre une partie + +**GET** `/party/join/:party_id` + +## Description + +Cet endpoint permet à un utilisateur de rejoindre une partie existante. + +### Paramètres de l'URL + +| Paramètre | Type | Requis | Description | +| --------- | ------ | ------ | ------------------------ | +| party_id | string | Oui | Identifiant de la partie | + +### Réponse + +La réponse ouvre un flux SSE (Server-Sent Events) pour recevoir des mises à jour en temps réel sur la partie. + +Voici la liste des événements envoyés : + +#### `userJoined` + +Cet événement est envoyé lorsqu'un nouvel utilisateur rejoint la partie. + +```json +[ + { + "id": 1, + "username": "Thomas", + "partyId": "693BCB", + "isHost": true + } +] +``` + +#### `question` + +Cet événement est envoyé lorsqu'une nouvelle question est affichée. + +```json +{ + "id": 62, + "text": "Which of these is NOT a catchphrase used by Rick Sanchez in the TV show \"Rick and Morty\"?", + "type": "multiple", + "categoryId": 2, + "quizId": "SY91WN", + "order": 0, + "answers": [ + { + "id": 209, + "text": "Slam dunk, nothing but net!", + "questionId": 62 + }, + { + "id": 210, + "text": "Hit the sack, Jack!", + "questionId": 62 + }, + { + "id": 211, + "text": "Rikki-Tikki-Tavi, biatch!", + "questionId": 62 + }, + { + "id": 212, + "text": "Wubba-lubba-dub-dub!", + "questionId": 62 + } + ], + "category": { + "id": 2, + "name": "Entertainment: Cartoon & Animations" + } +} +``` -### +#### `answerRevealed` + +```json +{ + "id": 62, + "text": "Which of these is NOT a catchphrase used by Rick Sanchez in the TV show \"Rick and Morty\"?", + "type": "multiple", + "categoryId": 2, + "quizId": "SY91WN", + "order": 0, + "answers": [ + { + "id": 209, + "text": "Slam dunk, nothing but net!", + "fileType": "text", + "isCorrect": true, + "questionId": 62 + }, + { + "id": 210, + "text": "Hit the sack, Jack!", + "fileType": null, + "isCorrect": false, + "questionId": 62 + } + ], + "category": { + "id": 2, + "name": "Entertainment: Cartoon & Animations" + } +} +``` + +#### `endGame` + +```json +[ + { + "id": 1, + "username": "Thomas", + "score": 1 + } +] +```