diff --git a/.eslintrc.js b/.eslintrc.js index 147ad2d3..5efe2ba4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -29,5 +29,6 @@ module.exports = { "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/ban-ts-comment": "off", + 'lines-between-class-members': ['error', 'always', { 'exceptAfterSingleLine': true }], } }; diff --git a/src/api/contacts.controller.ts b/src/api/contacts.controller.ts index 46868312..6c271809 100644 --- a/src/api/contacts.controller.ts +++ b/src/api/contacts.controller.ts @@ -67,6 +67,7 @@ export class ContactsController { const whatsapp = this.manager.getSession(request.session); return whatsapp.blockContact(request); } + @Post('/unblock') @ApiOperation({ summary: 'Unblock contact' }) unblock(@Body() request: ContactRequest) { diff --git a/src/structures/auth.dto.ts b/src/structures/auth.dto.ts index 3872ac54..62a86b57 100644 --- a/src/structures/auth.dto.ts +++ b/src/structures/auth.dto.ts @@ -6,6 +6,7 @@ export class RequestCodeRequest { example: '12132132130', }) phoneNumber: string; + @ApiProperty({ description: 'How would you like to receive the one time code for registration? |sms|voice. Leave empty for Web pairing.', diff --git a/src/structures/chatting.dto.ts b/src/structures/chatting.dto.ts index 4ce526ac..acd24310 100644 --- a/src/structures/chatting.dto.ts +++ b/src/structures/chatting.dto.ts @@ -28,6 +28,7 @@ export class CheckNumberStatusQuery extends SessionQuery { export class MessageTextQuery extends SessionQuery { @IsString() phone: string; + @IsString() text: string; } @@ -40,6 +41,7 @@ export class ChatQuery extends SessionQuery { export class GetMessageQuery extends ChatQuery { @IsNumber() limit: number; + @ApiProperty({ example: true, required: false, @@ -147,6 +149,7 @@ export class MessageVideoRequest extends ChatRequest { ], }) file: VideoRemoteFile | VideoBinaryFile; + caption: string = 'Just watch at this!'; } @@ -192,6 +195,7 @@ export class MessageDestination { example: 'false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA', }) id: string; + to: string; from: string; fromMe: boolean; diff --git a/src/structures/presence.dto.ts b/src/structures/presence.dto.ts index 0eaa8459..ca189fd6 100644 --- a/src/structures/presence.dto.ts +++ b/src/structures/presence.dto.ts @@ -8,6 +8,7 @@ export class WAHAPresenceData { example: '11111111111@c.us', }) participant: string; + lastKnownPresence: WAHAPresenceStatus; @ApiProperty({ example: 1686568773, @@ -20,6 +21,7 @@ export class WAHAChatPresences { example: '11111111111@c.us', }) id: string; + presences: WAHAPresenceData[]; } diff --git a/src/structures/sessions.dto.ts b/src/structures/sessions.dto.ts index 1ed1a2e8..c019b7bd 100644 --- a/src/structures/sessions.dto.ts +++ b/src/structures/sessions.dto.ts @@ -25,10 +25,12 @@ export class ProxyConfig { example: 'localhost:3128', }) server: string; + @ApiProperty({ example: null, }) username?: string; + @ApiProperty({ example: null, }) @@ -71,6 +73,7 @@ export class SessionDTO { export class MeInfo { @ChatIdProperty() id: string; + pushName: string; } diff --git a/src/structures/status.dto.ts b/src/structures/status.dto.ts index 8fd2a705..96c17a8d 100644 --- a/src/structures/status.dto.ts +++ b/src/structures/status.dto.ts @@ -33,6 +33,7 @@ export class ImageStatus extends StatusRequest { ], }) file: BinaryFile | RemoteFile; + caption: string; } @@ -45,6 +46,7 @@ export class VoiceStatus extends StatusRequest { ], }) file: VoiceBinaryFile | VoiceRemoteFile; + backgroundColor = '#38b42f'; } @@ -57,5 +59,6 @@ export class VideoStatus extends StatusRequest { ], }) file: BinaryFile | RemoteFile; + caption: string; } diff --git a/src/structures/webhooks.dto.ts b/src/structures/webhooks.dto.ts index a44e3c90..b69285a5 100644 --- a/src/structures/webhooks.dto.ts +++ b/src/structures/webhooks.dto.ts @@ -92,6 +92,7 @@ export class WASessionStatusBody { example: 'default', }) name: string; + status: WAHASessionStatus; } @@ -122,12 +123,14 @@ class WAHAWebhookSessionStatus extends WAHAWebhook { description: 'The event is triggered when the session status changes.', }) event = WAHAEvents.SESSION_STATUS; + payload: WASessionStatusBody; } class WAHAWebhookMessage extends WAHAWebhook { @ApiProperty({ description: 'Incoming message.' }) event = WAHAEvents.MESSAGE; + payload: WAMessage; } @@ -136,6 +139,7 @@ class WAHAWebhookMessageAny extends WAHAWebhook { description: 'Fired on all message creations, including your own.', }) event = WAHAEvents.MESSAGE_ANY; + payload: WAMessage; } @@ -145,6 +149,7 @@ class WAHAWebhookMessageAck extends WAHAWebhook { 'Receive events when server or recipient gets the message, read or played it.', }) event = WAHAEvents.MESSAGE_ACK; + payload: WAMessageAckBody; } @@ -155,6 +160,7 @@ class WAHAWebhookMessageRevoked extends WAHAWebhook { 'revokes a previously sent message.', }) event = WAHAEvents.MESSAGE_REVOKED; + payload: WAMessageRevokedBody; } @@ -163,6 +169,7 @@ class WAHAWebhookStateChange extends WAHAWebhook { description: 'It’s an internal engine’s state, not session status.', }) event = WAHAEvents.STATE_CHANGE; + payload: any; } @@ -171,6 +178,7 @@ class WAHAWebhookGroupJoin extends WAHAWebhook { description: 'Some one join a group.', }) event = WAHAEvents.GROUP_JOIN; + payload: any; } @@ -179,6 +187,7 @@ class WAHAWebhookGroupLeave extends WAHAWebhook { description: 'Some one left a group.', }) event = WAHAEvents.GROUP_LEAVE; + payload: any; } @@ -187,6 +196,7 @@ class WAHAWebhookPresenceUpdate extends WAHAWebhook { description: 'The most recent presence information for a chat.', }) event = WAHAEvents.PRESENCE_UPDATE; + payload: WAHAChatPresences; } @@ -195,6 +205,7 @@ class WAHAWebhookPollVote extends WAHAWebhook { description: 'With this event, you receive new votes for the poll sent.', }) event = WAHAEvents.POLL_VOTE; + payload: PollVotePayload; } @@ -205,6 +216,7 @@ class WAHAWebhookPollVoteFailed extends WAHAWebhook { 'Read more about how to handle such events: https://waha.devlike.pro/docs/how-to/polls/#pollvotefailed', }) event = WAHAEvents.POLL_VOTE_FAILED; + payload: PollVotePayload; }