From 61491019cfd78e2f538d39bda32c855a9f0593b7 Mon Sep 17 00:00:00 2001 From: Anton Voylenko Date: Fri, 6 Dec 2024 19:08:23 +0200 Subject: [PATCH] feat: add missing client response --- src/controllers/clientController.js | 400 ++++++++++ swagger.json | 1093 ++++++++++++++++++++++++++- 2 files changed, 1473 insertions(+), 20 deletions(-) diff --git a/src/controllers/clientController.js b/src/controllers/clientController.js index 90c5add..3c0fc81 100644 --- a/src/controllers/clientController.js +++ b/src/controllers/clientController.js @@ -124,6 +124,15 @@ const sendMessage = async (req, res) => { res.json({ success: true, message: messageOut }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ console.log(error) sendErrorResponse(res, 500, error.message) } @@ -148,6 +157,15 @@ const getClassInfo = (req, res) => { const sessionInfo = client.info res.json({ success: true, sessionInfo }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -187,6 +205,15 @@ const isRegisteredUser = async (req, res) => { const result = await client.isRegisteredUser(number) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -227,6 +254,15 @@ const getNumberId = async (req, res) => { const result = await client.getNumberId(number) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -282,6 +318,15 @@ const createGroup = async (req, res) => { } res.json({ success: true, response }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -321,6 +366,15 @@ const setStatus = async (req, res) => { await client.setStatus(status) res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -343,6 +397,15 @@ const getContacts = async (req, res) => { const contacts = await client.getContacts() res.json({ success: true, contacts }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -370,6 +433,15 @@ const getChats = async (req, res) => { const chats = await client.getChats() res.json({ success: true, chats }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -409,6 +481,15 @@ const getProfilePictureUrl = async (req, res) => { const result = await client.getProfilePicUrl(contactId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -449,6 +530,15 @@ const acceptInvite = async (req, res) => { const acceptInvite = await client.acceptInvite(inviteCode) res.json({ success: true, acceptInvite }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -474,6 +564,15 @@ const getWWebVersion = async (req, res) => { const result = await client.getWWebVersion() res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -514,6 +613,15 @@ const archiveChat = async (req, res) => { const result = await client.archiveChat(chatId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -538,6 +646,15 @@ const getBlockedContacts = async (req, res) => { const blockedContacts = await client.getBlockedContacts() res.json({ success: true, blockedContacts }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -575,8 +692,21 @@ const getChatById = async (req, res) => { const { chatId } = req.body const client = sessions.get(req.params.sessionId) const chat = await client.getChatById(chatId) + if (!chat) { + sendErrorResponse(res, 404, 'Chat not Found') + return + } res.json({ success: true, chat }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -616,6 +746,15 @@ const getChatLabels = async (req, res) => { const chatLabels = await client.getChatLabels(chatId) res.json({ success: true, chatLabels }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -655,6 +794,15 @@ const getChatsByLabelId = async (req, res) => { const chats = await client.getChatsByLabelId(labelId) res.json({ success: true, chats }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -694,6 +842,15 @@ const getCommonGroups = async (req, res) => { const groups = await client.getCommonGroups(contactId) res.json({ success: true, groups }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -732,6 +889,15 @@ const getContactById = async (req, res) => { const contact = await client.getContactById(contactId) res.json({ success: true, contact }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -771,6 +937,15 @@ const getInviteInfo = async (req, res) => { const inviteInfo = await client.getInviteInfo(inviteCode) res.json({ success: true, inviteInfo }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -810,6 +985,15 @@ const getLabelById = async (req, res) => { const label = await client.getLabelById(labelId) res.json({ success: true, label }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -833,6 +1017,15 @@ const getLabels = async (req, res) => { const labels = await client.getLabels() res.json({ success: true, labels }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -874,6 +1067,15 @@ const addOrRemoveLabels = async (req, res) => { await client.addOrRemoveLabels(labelIds, chatIds) res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -897,6 +1099,15 @@ const getState = async (req, res) => { const state = await client.getState() res.json({ success: true, state }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -936,6 +1147,15 @@ const markChatUnread = async (req, res) => { await client.markChatUnread(chatId) res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -986,6 +1206,15 @@ const muteChat = async (req, res) => { } res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1025,6 +1254,15 @@ const pinChat = async (req, res) => { const result = await client.pinChat(chatId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1074,6 +1312,15 @@ const searchMessages = async (req, res) => { } res.json({ success: true, messages }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1097,6 +1344,15 @@ const sendPresenceAvailable = async (req, res) => { await client.sendPresenceAvailable() res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1120,6 +1376,15 @@ const sendPresenceUnavailable = async (req, res) => { await client.sendPresenceUnavailable() res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1158,6 +1423,15 @@ const sendSeen = async (req, res) => { const result = await client.sendSeen(chatId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1197,6 +1471,15 @@ const setDisplayName = async (req, res) => { const result = await client.setDisplayName(displayName) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1235,6 +1518,15 @@ const unarchiveChat = async (req, res) => { const result = await client.unarchiveChat(chatId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1274,6 +1566,15 @@ const unmuteChat = async (req, res) => { const result = await client.unmuteChat(chatId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1313,6 +1614,15 @@ const unpinChat = async (req, res) => { const result = await client.unpinChat(chatId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1357,6 +1667,15 @@ const setProfilePicture = async (req, res) => { const result = await client.setProfilePicture(media) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1378,6 +1697,15 @@ const deleteProfilePicture = async (req, res) => { const result = await client.deleteProfilePicture() res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1413,6 +1741,15 @@ const setAutoDownloadAudio = async (req, res) => { await client.setAutoDownloadAudio(flag) res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1448,6 +1785,15 @@ const setAutoDownloadDocuments = async (req, res) => { await client.setAutoDownloadDocuments(flag) res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1483,6 +1829,15 @@ const setAutoDownloadPhotos = async (req, res) => { await client.setAutoDownloadPhotos(flag) res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1518,6 +1873,15 @@ const setAutoDownloadVideos = async (req, res) => { await client.setAutoDownloadVideos(flag) res.json({ success: true }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1557,6 +1921,15 @@ const syncHistory = async (req, res) => { const result = await client.syncHistory(chatId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1597,6 +1970,15 @@ const getContactDeviceCount = async (req, res) => { const result = await client.getContactDeviceCount(userId) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1636,6 +2018,15 @@ const getCountryCode = async (req, res) => { const result = await client.getCountryCode(number) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } @@ -1675,6 +2066,15 @@ const getFormattedNumber = async (req, res) => { const result = await client.getFormattedNumber(number) res.json({ success: true, result }) } catch (error) { + /* #swagger.responses[500] = { + description: "Server Failure.", + content: { + "application/json": { + schema: { "$ref": "#/definitions/ErrorResponse" } + } + } + } + */ sendErrorResponse(res, 500, error.message) } } diff --git a/swagger.json b/swagger.json index 69dff6b..b3d89be 100644 --- a/swagger.json +++ b/swagger.json @@ -648,6 +648,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -709,6 +719,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -799,6 +819,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -889,6 +919,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -999,6 +1039,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1060,6 +1110,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1150,6 +1210,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1240,6 +1310,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1301,6 +1381,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1391,6 +1481,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1481,6 +1581,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1571,6 +1681,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1632,6 +1752,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1722,6 +1852,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1812,6 +1952,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1873,6 +2023,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -1973,6 +2133,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2063,6 +2233,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2153,6 +2333,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2233,6 +2423,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2294,6 +2494,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2384,6 +2594,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2484,6 +2704,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2574,6 +2804,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2674,6 +2914,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2869,6 +3119,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2930,6 +3190,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -2991,6 +3261,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3081,6 +3361,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3149,6 +3439,9 @@ } ], "responses": { + "200": { + "description": "OK" + }, "403": { "description": "Forbidden.", "content": { @@ -3178,6 +3471,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3268,6 +3571,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3358,6 +3671,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3448,6 +3771,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3538,6 +3871,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3628,6 +3971,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3689,6 +4042,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3750,6 +4113,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3840,6 +4213,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -3930,6 +4313,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4020,6 +4413,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4110,6 +4513,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4200,6 +4613,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4290,6 +4713,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4380,6 +4813,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4423,6 +4866,7 @@ "tags": [ "Chat" ], + "summary": "Get the chat", "description": "", "parameters": [ { @@ -4469,6 +4913,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4485,7 +4939,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4497,7 +4951,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4512,6 +4966,7 @@ "tags": [ "Chat" ], + "summary": "Clear all messages from the chat", "description": "", "parameters": [ { @@ -4558,6 +5013,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4574,7 +5039,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4586,7 +5051,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4601,6 +5066,7 @@ "tags": [ "Chat" ], + "summary": "Stop typing or recording in chat immediately", "description": "", "parameters": [ { @@ -4647,6 +5113,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4663,7 +5139,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4675,7 +5151,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4690,6 +5166,7 @@ "tags": [ "Chat" ], + "summary": "Delete the chat", "description": "", "parameters": [ { @@ -4736,6 +5213,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4752,7 +5239,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4764,7 +5251,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4779,7 +5266,8 @@ "tags": [ "Chat" ], - "description": "", + "summary": "Load chat messages", + "description": "Messages sorted from earliest to latest", "parameters": [ { "name": "sessionId", @@ -4825,6 +5313,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4841,13 +5339,16 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" }, "searchOptions": { "type": "object", "description": "Search options for fetching messages", - "example": "{}" + "example": { + "limit": 10, + "fromMe": true + } } } } @@ -4858,13 +5359,16 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" }, "searchOptions": { "type": "object", "description": "Search options for fetching messages", - "example": "{}" + "example": { + "limit": 10, + "fromMe": true + } } } } @@ -4878,6 +5382,7 @@ "tags": [ "Chat" ], + "summary": "Get the contact", "description": "", "parameters": [ { @@ -4924,6 +5429,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -4940,7 +5455,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4952,7 +5467,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -4967,7 +5482,8 @@ "tags": [ "Chat" ], - "description": "", + "summary": "Simulate recording audio", + "description": "Simulate recording audio in chat. This will last for 25 seconds", "parameters": [ { "name": "sessionId", @@ -5013,6 +5529,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -5029,7 +5555,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -5041,7 +5567,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -5056,6 +5582,107 @@ "tags": [ "Chat" ], + "summary": "Simulate typing in chat", + "description": "Simulate typing in chat. This will last for 25 seconds.", + "parameters": [ + { + "name": "sessionId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Unique identifier for the session (alphanumeric and - allowed)", + "example": "f8377d8d-a589-4242-9ba6-9486a04ef80c" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForbiddenResponse" + } + } + } + }, + "404": { + "description": "Not Found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "apiKeyAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + }, + "application/xml": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + } + } + } + } + }, + "/chat/sendSeen/{sessionId}": { + "post": { + "tags": [ + "Chat" + ], + "summary": "Set the message as seen", "description": "", "parameters": [ { @@ -5102,6 +5729,16 @@ } } } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } } }, "security": [ @@ -5118,7 +5755,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -5130,7 +5767,7 @@ "properties": { "chatId": { "type": "string", - "description": "Unique whatsApp identifier for the given Chat (either group or personnal)", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", "example": "6281288888888@c.us" } } @@ -5140,6 +5777,422 @@ } } }, + "/chat/markUnread/{sessionId}": { + "post": { + "tags": [ + "Chat" + ], + "summary": "Mark this chat as unread", + "description": "", + "parameters": [ + { + "name": "sessionId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Unique identifier for the session (alphanumeric and - allowed)", + "example": "f8377d8d-a589-4242-9ba6-9486a04ef80c" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForbiddenResponse" + } + } + } + }, + "404": { + "description": "Not Found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "apiKeyAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + }, + "application/xml": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + } + } + } + } + }, + "/chat/syncHistory/{sessionId}": { + "post": { + "tags": [ + "Chat" + ], + "summary": "Sync chat history", + "description": "", + "parameters": [ + { + "name": "sessionId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Unique identifier for the session (alphanumeric and - allowed)", + "example": "f8377d8d-a589-4242-9ba6-9486a04ef80c" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForbiddenResponse" + } + } + } + }, + "404": { + "description": "Not Found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "apiKeyAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + }, + "application/xml": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + } + } + } + } + }, + "/chat/getLabels/{sessionId}": { + "post": { + "tags": [ + "Chat" + ], + "summary": "Return all labels", + "description": "Return array of all labels assigned to this chat", + "parameters": [ + { + "name": "sessionId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Unique identifier for the session (alphanumeric and - allowed)", + "example": "f8377d8d-a589-4242-9ba6-9486a04ef80c" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForbiddenResponse" + } + } + } + }, + "404": { + "description": "Not Found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "apiKeyAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + }, + "application/xml": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + } + } + } + } + } + } + } + }, + "/chat/changeLabels/{sessionId}": { + "post": { + "tags": [ + "Chat" + ], + "summary": "Add or remove labels", + "description": "", + "parameters": [ + { + "name": "sessionId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Unique identifier for the session (alphanumeric and - allowed)", + "example": "f8377d8d-a589-4242-9ba6-9486a04ef80c" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ForbiddenResponse" + } + } + } + }, + "404": { + "description": "Not Found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Server Failure.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + }, + "security": [ + { + "apiKeyAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + }, + "labelIds": { + "type": "array", + "description": "Array of (number or string)", + "example": [ + 0, + 1 + ] + } + } + } + }, + "application/xml": { + "schema": { + "type": "object", + "properties": { + "chatId": { + "type": "string", + "description": "Unique WhatsApp identifier for the given Chat (either group or personal)", + "example": "6281288888888@c.us" + }, + "labelIds": { + "type": "array", + "description": "Array of (number or string)", + "example": [ + 0, + 1 + ] + } + } + } + } + } + } + } + }, "/groupChat/getClassInfo/{sessionId}": { "post": { "tags": [