Spaces:
Sleeping
Sleeping
Download src/modules/status/status.controller.ts from jinksQspider/openWa: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/spaces/jinksQspider/openWa/resolve/main/src/modules/status/status.controller.ts
- Command line
-
hf download hf://spaces/jinksQspider/openWa/src/modules/status/status.controller.ts
-
curl -L -o status.controller.ts https://huggingface.co/spaces/jinksQspider/openWa/resolve/main/src/modules/status/status.controller.ts
2.13 kB
| import { Controller, Get, Post, Delete, Param, Body } from '@nestjs/common'; | |
| import { ApiTags, ApiOperation } from '@nestjs/swagger'; | |
| import { StatusService } from './status.service'; | |
| import { SendTextStatusDto } from './dto/send-text-status.dto'; | |
| import { SendImageStatusDto, SendVideoStatusDto } from './dto/send-media-status.dto'; | |
| ('Status') | |
| ('sessions/:sessionId/status') | |
| export class StatusController { | |
| constructor(private readonly statusService: StatusService) {} | |
| () | |
| ({ summary: 'Get all contact status updates' }) | |
| async getStatuses(('sessionId') sessionId: string) { | |
| return { statuses: await this.statusService.getStatuses(sessionId) }; | |
| } | |
| (':contactId') | |
| ({ summary: 'Get status updates from a specific contact' }) | |
| async getContactStatus(('sessionId') sessionId: string, ('contactId') contactId: string) { | |
| return { statuses: await this.statusService.getContactStatus(sessionId, contactId) }; | |
| } | |
| ('send-text') | |
| ({ summary: 'Post a text status' }) | |
| async sendTextStatus(('sessionId') sessionId: string, () dto: SendTextStatusDto) { | |
| return this.statusService.postTextStatus(sessionId, dto.text, { | |
| backgroundColor: dto.backgroundColor, | |
| font: dto.font, | |
| }); | |
| } | |
| ('send-image') | |
| ({ summary: 'Post an image status' }) | |
| async sendImageStatus(('sessionId') sessionId: string, () dto: SendImageStatusDto) { | |
| return this.statusService.postImageStatus(sessionId, dto.image, dto.caption); | |
| } | |
| ('send-video') | |
| ({ summary: 'Post a video status' }) | |
| async sendVideoStatus(('sessionId') sessionId: string, () dto: SendVideoStatusDto) { | |
| return this.statusService.postVideoStatus(sessionId, dto.video, dto.caption); | |
| } | |
| (':statusId') | |
| ({ summary: 'Delete own status' }) | |
| async deleteStatus(('sessionId') sessionId: string, ('statusId') statusId: string) { | |
| await this.statusService.deleteStatus(sessionId, statusId); | |
| return { message: 'Status deleted successfully' }; | |
| } | |
| } | |