@open-wa/wa-automate 4.42.0 → 4.42.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -570,8 +570,10 @@ export declare class Client {
570
570
  * @param to chat id: `xxxxx@c.us`
571
571
  * @param content text message
572
572
  * @param replyMessageId id of message to reply to
573
+ * @param hideTags Removes all tags within the message
574
+ * @param mentions You can optionally add an array of contact IDs to tag only specific people
573
575
  */
574
- sendReplyWithMentions(to: ChatId, content: Content, replyMessageId: MessageId): Promise<boolean | MessageId>;
576
+ sendReplyWithMentions(to: ChatId, content: Content, replyMessageId: MessageId, hideTags?: boolean, mentions?: ContactId[]): Promise<boolean | MessageId>;
575
577
  /**
576
578
  * [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
577
579
  *
@@ -1454,15 +1454,17 @@ class Client {
1454
1454
  * @param to chat id: `xxxxx@c.us`
1455
1455
  * @param content text message
1456
1456
  * @param replyMessageId id of message to reply to
1457
+ * @param hideTags Removes all tags within the message
1458
+ * @param mentions You can optionally add an array of contact IDs to tag only specific people
1457
1459
  */
1458
- sendReplyWithMentions(to, content, replyMessageId) {
1460
+ sendReplyWithMentions(to, content, replyMessageId, hideTags, mentions) {
1459
1461
  return __awaiter(this, void 0, void 0, function* () {
1460
1462
  //remove all @c.us from the content
1461
1463
  content = content.replace(/@c.us/, "");
1462
- return yield this.pup(({ to, content, replyMessageId }) => {
1464
+ return yield this.pup(({ to, content, replyMessageId, hideTags, mentions }) => {
1463
1465
  WAPI.sendSeen(to);
1464
- return WAPI.sendReplyWithMentions(to, content, replyMessageId);
1465
- }, { to, content, replyMessageId });
1466
+ return WAPI.sendReplyWithMentions(to, content, replyMessageId, hideTags, mentions);
1467
+ }, { to, content, replyMessageId, hideTags, mentions });
1466
1468
  });
1467
1469
  }
1468
1470
  /**
@@ -46,6 +46,24 @@ const generateCollections = (config, spinner) => __awaiter(void 0, void 0, void
46
46
  pmCol = yield (0, __1.generatePostmanJson)(config);
47
47
  spinner.succeed(`Postman collection generated: open-wa-${config.sessionId}.postman_collection.json`);
48
48
  swCol = (0, postman_2_swagger_1.default)(pmCol);
49
+ swCol.tags = [
50
+ {
51
+ "name": "default",
52
+ "description": "All methods from the Client",
53
+ "externalDocs": {
54
+ "description": "Find out more",
55
+ "url": "https://docs.openwa.dev/classes/api_Client.Client.html"
56
+ }
57
+ },
58
+ {
59
+ "name": "meta",
60
+ "description": "Operations related to generating SDKs for this specific API"
61
+ },
62
+ {
63
+ "name": "media",
64
+ "description": "Access files in the /media folder when messagePreProcessor is set to AUTO_DECRYPT_SAVE"
65
+ }
66
+ ];
49
67
  /**
50
68
  * Fix swagger docs by removing the content type as a required paramater
51
69
  */
@@ -57,7 +75,7 @@ const generateCollections = (config, spinner) => __awaiter(void 0, void 0, void
57
75
  "api_key": []
58
76
  }
59
77
  ];
60
- swCol.paths[p].nickname = p.replace("/", "");
78
+ swCol.paths[p].operationId = swCol.paths[p].nickname = p.replace("/", "");
61
79
  swCol.paths[p].post.externalDocs = {
62
80
  "description": "Documentation",
63
81
  "url": swCol.paths[p].post.documentationUrl
@@ -78,6 +96,121 @@ const generateCollections = (config, spinner) => __awaiter(void 0, void 0, void
78
96
  };
79
97
  delete path.parameters;
80
98
  });
99
+ const metaPaths = {
100
+ "/media/{fileName}": {
101
+ "get": {
102
+ "summary": "Get a file from the /media folder",
103
+ "description": "Make sure to set messagePreProcessor to AUTO_DECRYPT_SAVE in order to decrypt and save media within the /media folder",
104
+ tags: ["media"],
105
+ "produces": [
106
+ "application/pdf",
107
+ "image/jpeg",
108
+ "image/jpg",
109
+ "image/png",
110
+ "image/webp",
111
+ "audio/mpeg",
112
+ "audio/ogg",
113
+ "audio/vorbis",
114
+ "video/mp4",
115
+ ],
116
+ "parameters": [
117
+ {
118
+ "name": "fileName",
119
+ "in": "path",
120
+ "description": "The filename, e.g: 2B8A12C1DAF21D8CA34105560D5B1864.jpeg",
121
+ "required": true,
122
+ "type": "string",
123
+ }
124
+ ],
125
+ "responses": {
126
+ "200": {
127
+ "description": "Downloaded file"
128
+ },
129
+ "404": {
130
+ "description": "File not found"
131
+ },
132
+ }
133
+ }
134
+ },
135
+ "/meta/swagger.json": {
136
+ "get": {
137
+ "description": "Get a swagger/OAS collection json",
138
+ tags: ["meta"],
139
+ "produces": [
140
+ "application/json",
141
+ ],
142
+ "responses": {
143
+ "200": {
144
+ "description": "successful request"
145
+ },
146
+ }
147
+ }
148
+ },
149
+ "/meta/postman.json": {
150
+ "get": {
151
+ "description": "Get a postman collection json",
152
+ tags: ["meta"],
153
+ "produces": [
154
+ "application/json",
155
+ ],
156
+ "responses": {
157
+ "200": {
158
+ "description": "successful request"
159
+ },
160
+ }
161
+ }
162
+ },
163
+ "/meta/basic/commands": {
164
+ get: {
165
+ "description": "Get a list of possible client methods/commands",
166
+ tags: ["meta"],
167
+ "produces": [
168
+ "application/json",
169
+ ],
170
+ "responses": {
171
+ "200": {
172
+ "description": "successful request"
173
+ },
174
+ }
175
+ }
176
+ },
177
+ "/meta/basic/listeners": {
178
+ get: {
179
+ "description": "Get a list of possible listeners",
180
+ tags: ["meta"],
181
+ "produces": [
182
+ "application/json",
183
+ ],
184
+ "responses": {
185
+ "200": {
186
+ "description": "successful request"
187
+ },
188
+ }
189
+ }
190
+ },
191
+ "/meta/codegen/{language}": {
192
+ post: {
193
+ "summary": "Generate SDK",
194
+ "description": "Generate a SDK for this specific API - see https://codegen.openwa.dev/api/gen/clients for list of possible languages",
195
+ tags: ["meta"],
196
+ "parameters": [
197
+ {
198
+ "name": "language",
199
+ "in": "path",
200
+ "description": "The language to generate the SDK for. ",
201
+ "required": true,
202
+ "type": "string",
203
+ }
204
+ ],
205
+ "responses": {
206
+ "200": {
207
+ "description": "successful request"
208
+ },
209
+ }
210
+ }
211
+ }
212
+ };
213
+ swCol.paths = Object.assign(Object.assign({}, swCol.paths), metaPaths);
81
214
  delete swCol.swagger;
82
215
  swCol.openapi = "3.0.3";
83
216
  swCol.components = {};
@@ -103,6 +103,10 @@ const setupApiDocs = (cliConfig) => {
103
103
  return res.redirect('api-docs/');
104
104
  next();
105
105
  }, swagger_ui_express_1.default.serve, swagger_ui_express_1.default.setup(collections_1.collections["swagger"], swOptions));
106
+ /**
107
+ * Redirect to api docs if no path is specified
108
+ */
109
+ exports.app.use('/', (req, res) => res.redirect('/api-docs'));
106
110
  };
107
111
  exports.setupApiDocs = setupApiDocs;
108
112
  const setupSwaggerStatsMiddleware = (cliConfig) => __awaiter(void 0, void 0, void 0, function* () {
@@ -67,7 +67,7 @@ export declare class SocketClient {
67
67
  };
68
68
  };
69
69
  /**
70
- * The main way to create the socket baed client.
70
+ * The main way to create the socket based client.
71
71
  * @param url URL of the socket server (i.e the EASY API instance address)
72
72
  * @param apiKey optional api key if set
73
73
  * @returns SocketClient
@@ -113,7 +113,7 @@ class SocketClient {
113
113
  });
114
114
  }
115
115
  /**
116
- * The main way to create the socket baed client.
116
+ * The main way to create the socket based client.
117
117
  * @param url URL of the socket server (i.e the EASY API instance address)
118
118
  * @param apiKey optional api key if set
119
119
  * @returns SocketClient
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.42.0",
3
+ "version": "4.42.3",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",