-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.config.js
More file actions
110 lines (107 loc) · 4.23 KB
/
swagger.config.js
File metadata and controls
110 lines (107 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const paths = require('./swagger-paths');
const swaggerSpec = {
openapi: '3.0.0',
info: {
title: 'WhatsApp Web.js API',
version: '1.0.0',
description: 'REST API for WhatsApp Web automation using whatsapp-web.js library. Send messages, manage chats, handle media, and control WhatsApp groups programmatically.',
contact: {
name: 'API Support',
url: 'https://github.com/pedroslopez/whatsapp-web.js'
},
license: {
name: 'Apache 2.0',
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
}
},
servers: [
{
url: 'http://localhost:3000',
description: 'Development server'
}
],
tags: [
{ name: 'Authentication', description: 'Login and session management' },
{ name: 'Clients', description: 'WhatsApp client instance management' },
{ name: 'Messaging', description: 'Send messages, media, stickers, and polls' },
{ name: 'Chats', description: 'Chat and message history' },
{ name: 'Contacts', description: 'Contact management and profile data' },
{ name: 'Groups', description: 'Group management and participant control' },
{ name: 'Channels', description: 'WhatsApp Channels (Newsletter) features' },
{ name: 'Media', description: 'Media file downloads and management' },
{ name: 'Labels', description: 'WhatsApp Business label management' }
],
paths: paths,
components: {
securitySchemes: {
ApiKeyAuth: {
type: 'apiKey',
in: 'query',
name: 'api_key',
description: 'API key for authentication'
},
ClientId: {
type: 'apiKey',
in: 'query',
name: 'client',
description: 'Client ID (default: "default")'
}
},
schemas: {
Client: {
type: 'object',
properties: {
id: { type: 'string', example: 'default' },
status: { type: 'string', example: 'authenticated' },
apiKey: { type: 'string', example: 'ak_1234567890abcdef' },
uptime: { type: 'string', example: '2h 15m 30s' },
messagesSaved: { type: 'integer', example: 142 }
}
},
Chat: {
type: 'object',
properties: {
id: { type: 'string', example: '6281234567890@c.us' },
name: { type: 'string', example: 'John Doe' },
isGroup: { type: 'boolean', example: false }
}
},
Contact: {
type: 'object',
properties: {
id: { type: 'string', example: '6281234567890@c.us' },
name: { type: 'string', example: 'John Doe' },
pushname: { type: 'string', example: 'Johnny' },
number: { type: 'string', example: '6281234567890' }
}
},
Message: {
type: 'object',
properties: {
id: { type: 'string', example: 'true_6281234567890@c.us_3EB0123456789' },
from: { type: 'string', example: '6281234567890@c.us' },
body: { type: 'string', example: 'Hello, world!' },
timestamp: { type: 'integer', example: 1640000000 },
hasMedia: { type: 'boolean', example: false }
}
},
Error: {
type: 'object',
properties: {
error: { type: 'string', example: 'Error message' }
}
},
Success: {
type: 'object',
properties: {
success: { type: 'boolean', example: true },
id: { type: 'string', example: 'message_id_here' }
}
}
}
},
security: [
{ ApiKeyAuth: [], ClientId: [] }
]
};
module.exports = swaggerSpec;