Spaces:
Runtime error
Runtime error
File size: 3,022 Bytes
4327358 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
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 {
@IsString()
@ApiProperty({
example: '123456789@c.us',
})
id: string;
}
export class SettingsSecurityChangeInfo {
adminsOnly: boolean = true;
}
/**
* Queries
*/
/**
* Requests
*/
export class ParticipantsRequest {
@IsArray()
participants: Array<Participant>;
}
export class DescriptionRequest {
@IsString()
description: string;
}
export class SubjectRequest {
@IsString()
subject: string;
}
export class CreateGroupRequest {
@IsString()
name: string;
@IsArray()
participants: Array<Participant>;
}
export class JoinGroupRequest {
@ApiProperty({
description: 'Group code (123) or url (https://chat.whatsapp.com/123)',
example: 'https://chat.whatsapp.com/1234567890abcdef',
})
@IsString()
code: string;
}
export class JoinGroupResponse {
@ApiProperty({
description: 'Group ID',
example: '123@g.us',
})
id: string;
}
export enum GroupField {
NONE = '',
PARTICIPANTS = 'participants',
}
export class GroupsListFields {
@IsOptional()
@ApiProperty({
description: 'Exclude fields',
enum: GroupField,
isArray: true,
required: false,
})
@IsEnum(GroupField, { each: true })
exclude: string[];
}
export enum GroupSortField {
ID = 'id',
SUBJECT = 'subject',
}
export class GroupsPaginationParams extends PaginationParams {
@ApiProperty({
description: 'Sort by field',
enum: GroupSortField,
})
@IsOptional()
@IsEnum(GroupSortField)
sortBy?: string;
}
export enum GroupParticipantRole {
LEFT = 'left',
PARTICIPANT = 'participant',
ADMIN = 'admin',
SUPERADMIN = 'superadmin',
}
export class GroupParticipant {
@ApiProperty({
example: '123456789@c.us',
})
id: string;
@ApiProperty({
example: GroupParticipantRole.PARTICIPANT,
})
role: GroupParticipantRole;
}
export class GroupId {
@ApiProperty({
example: '123456789@g.us',
})
id: string;
}
export class GroupInfo {
@ApiProperty({
example: '123456789@g.us',
})
id: string;
@ApiProperty({
example: 'Group Name',
})
subject: string;
@ApiProperty({
example: 'Group Description',
})
description: string;
participants: GroupParticipant[];
@ApiProperty({
description: 'Invite URL',
example: 'https://chat.whatsapp.com/1234567890abcdef',
})
invite?: string;
@ApiProperty({
description: 'Members can add new members',
})
membersCanAddNewMember: boolean;
@ApiProperty({
description: 'Members can send messages to the group',
})
membersCanSendMessages: boolean;
@ApiProperty({
description: 'Admin approval required for new members',
})
newMembersApprovalRequired: boolean;
}
|