import { Body, Controller, Delete, Get, NotFoundException, Param, Post, Put, UnprocessableEntityException, UsePipes, ValidationPipe, } from '@nestjs/common'; import { ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { WhatsappSession } from '@waha/core/abc/session.abc'; import { ChatIdApiParam } from '@waha/nestjs/params/ChatIdApiParam'; import { SessionApiParam, WorkingSessionParam, } from '@waha/nestjs/params/SessionApiParam'; import { Label, LabelBody, SetLabelsRequest, } from '@waha/structures/labels.dto'; import * as lodash from 'lodash'; import { SessionManager } from '../core/abc/manager.abc'; @ApiSecurity('api_key') @Controller('api/:session/labels') @ApiTags('🏷️ Labels') export class LabelsController { constructor(private manager: SessionManager) {} @Get('/') @SessionApiParam @ApiOperation({ summary: 'Get all labels' }) getAll(@WorkingSessionParam session: WhatsappSession): Promise { return session.getLabels(); } @Post('/') @SessionApiParam @ApiOperation({ summary: 'Create a new label' }) @UsePipes(new ValidationPipe({ transform: true, whitelist: true })) async create( @WorkingSessionParam session: WhatsappSession, @Body() body: LabelBody, ): Promise