Spaces:
Runtime error
Runtime error
| import { ApiProperty } from '@nestjs/swagger'; | |
| import { BooleanString } from '@waha/nestjs/validation/BooleanString'; | |
| import { Transform } from 'class-transformer'; | |
| import { | |
| IsArray, | |
| IsBoolean, | |
| IsEnum, | |
| IsOptional, | |
| IsString, | |
| } from 'class-validator'; | |
| import { PaginationParams } from './pagination.dto'; | |
| /** | |
| * Structures | |
| */ | |
| export class Participant { | |
| () | |
| ({ | |
| example: '123456789@c.us', | |
| }) | |
| id: string; | |
| } | |
| export class SettingsSecurityChangeInfo { | |
| adminsOnly: boolean = true; | |
| } | |
| /** | |
| * Queries | |
| */ | |
| /** | |
| * Requests | |
| */ | |
| export class ParticipantsRequest { | |
| () | |
| participants: Array<Participant>; | |
| } | |
| export class DescriptionRequest { | |
| () | |
| description: string; | |
| } | |
| export class SubjectRequest { | |
| () | |
| subject: string; | |
| } | |
| export class CreateGroupRequest { | |
| () | |
| name: string; | |
| () | |
| participants: Array<Participant>; | |
| } | |
| export class JoinGroupRequest { | |
| ({ | |
| description: 'Group code (123) or url (https://chat.whatsapp.com/123)', | |
| example: 'https://chat.whatsapp.com/1234567890abcdef', | |
| }) | |
| () | |
| code: string; | |
| } | |
| export class JoinGroupResponse { | |
| ({ | |
| description: 'Group ID', | |
| example: '123@g.us', | |
| }) | |
| id: string; | |
| } | |
| export enum GroupField { | |
| NONE = '', | |
| PARTICIPANTS = 'participants', | |
| } | |
| export class GroupsListFields { | |
| () | |
| ({ | |
| description: 'Exclude fields', | |
| enum: GroupField, | |
| isArray: true, | |
| required: false, | |
| }) | |
| (GroupField, { each: true }) | |
| exclude: string[]; | |
| } | |
| export enum GroupSortField { | |
| ID = 'id', | |
| SUBJECT = 'subject', | |
| } | |
| export class GroupsPaginationParams extends PaginationParams { | |
| ({ | |
| description: 'Sort by field', | |
| enum: GroupSortField, | |
| }) | |
| () | |
| (GroupSortField) | |
| sortBy?: string; | |
| } | |
| export enum GroupParticipantRole { | |
| LEFT = 'left', | |
| PARTICIPANT = 'participant', | |
| ADMIN = 'admin', | |
| SUPERADMIN = 'superadmin', | |
| } | |
| export class GroupParticipant { | |
| ({ | |
| example: '123456789@c.us', | |
| }) | |
| id: string; | |
| ({ | |
| example: GroupParticipantRole.PARTICIPANT, | |
| }) | |
| role: GroupParticipantRole; | |
| } | |
| export class GroupId { | |
| ({ | |
| example: '123456789@g.us', | |
| }) | |
| id: string; | |
| } | |
| export class GroupInfo { | |
| ({ | |
| example: '123456789@g.us', | |
| }) | |
| id: string; | |
| ({ | |
| example: 'Group Name', | |
| }) | |
| subject: string; | |
| ({ | |
| example: 'Group Description', | |
| }) | |
| description: string; | |
| participants: GroupParticipant[]; | |
| ({ | |
| description: 'Invite URL', | |
| example: 'https://chat.whatsapp.com/1234567890abcdef', | |
| }) | |
| invite?: string; | |
| ({ | |
| description: 'Members can add new members', | |
| }) | |
| membersCanAddNewMember: boolean; | |
| ({ | |
| description: 'Members can send messages to the group', | |
| }) | |
| membersCanSendMessages: boolean; | |
| ({ | |
| description: 'Admin approval required for new members', | |
| }) | |
| newMembersApprovalRequired: boolean; | |
| } | |