feat: add ability to run any method

This commit is contained in:
Anton Voylenko 2025-08-10 15:19:07 +03:00
commit b7d1e21739
6 changed files with 798 additions and 22 deletions

View file

@ -3732,15 +3732,21 @@
"schema": {
"type": "object",
"properties": {
"userIds": {
"type": "array",
"items": {
"type": "string",
"description": "The unique identifier of the user"
},
"example": [
"6281288888888@c.us"
]
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
@ -3749,15 +3755,21 @@
"schema": {
"type": "object",
"properties": {
"userIds": {
"type": "array",
"items": {
"type": "string",
"description": "The unique identifier of the user"
},
"example": [
"6281288888888@c.us"
]
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
@ -5589,6 +5601,128 @@
}
}
},
"/client/runMethod/{sessionId}": {
"post": {
"tags": [
"Client"
],
"summary": "Execute a method on the client",
"description": "Execute a method on the client and return the result",
"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": {
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
},
"application/xml": {
"schema": {
"type": "object",
"properties": {
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
}
}
}
}
},
"/chat/getClassInfo/{sessionId}": {
"post": {
"tags": [
@ -6921,6 +7055,138 @@
}
}
},
"/chat/runMethod/{sessionId}": {
"post": {
"tags": [
"Chat"
],
"summary": "Execute a method on the chat",
"description": "Execute a method on the chat and return the result",
"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": "The chat id which contains the message",
"example": "6281288888888@c.us"
},
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
},
"application/xml": {
"schema": {
"type": "object",
"properties": {
"chatId": {
"type": "string",
"description": "The chat id which contains the message",
"example": "6281288888888@c.us"
},
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
}
}
}
}
},
"/groupChat/getClassInfo/{sessionId}": {
"post": {
"tags": [
@ -8799,6 +9065,138 @@
}
}
},
"/groupChat/runMethod/{sessionId}": {
"post": {
"tags": [
"Group Chat"
],
"summary": "Execute a method on the group",
"description": "Execute a method on the group and return the result",
"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 id for the given chat group",
"example": "XXXXXXXXXX@g.us"
},
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
},
"application/xml": {
"schema": {
"type": "object",
"properties": {
"chatId": {
"type": "string",
"description": "Unique WhatsApp id for the given chat group",
"example": "XXXXXXXXXX@g.us"
},
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getLabels"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
}
}
}
}
},
"/message/getClassInfo/{sessionId}": {
"post": {
"tags": [
@ -10840,6 +11238,148 @@
}
}
},
"/message/runMethod/{sessionId}": {
"post": {
"tags": [
"Message"
],
"summary": "Execute a method on the message",
"description": "Execute a method on the message and return the result",
"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": "The chat id which contains the message",
"example": "6281288888888@c.us"
},
"messageId": {
"type": "string",
"description": "Unique WhatsApp identifier for the message",
"example": "ABCDEF999999999"
},
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getInfo"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
},
"application/xml": {
"schema": {
"type": "object",
"properties": {
"chatId": {
"type": "string",
"description": "The chat id which contains the message",
"example": "6281288888888@c.us"
},
"messageId": {
"type": "string",
"description": "Unique WhatsApp identifier for the message",
"example": "ABCDEF999999999"
},
"method": {
"type": "string",
"description": "The name of the method to execute",
"example": "getInfo"
},
"options": {
"anyOf": [
{
"type": "object"
},
{
"type": "string"
}
],
"description": "The options to pass to the method"
}
}
}
}
}
}
}
},
"/contact/getClassInfo/{sessionId}": {
"post": {
"tags": [