File size: 985 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
import { ApiExtraModels, ApiProperty, getSchemaPath } from '@nestjs/swagger';
import { BinaryFile, RemoteFile } from '@waha/structures/files.dto';
import { ChatIdProperty } from '@waha/structures/properties.dto';
import { IsNotEmpty, IsString } from 'class-validator';

export class MyProfile {
  @ChatIdProperty()
  id: string;

  name: string;

  @ApiProperty({
    example: 'https://example.com/picture.jpg',
  })
  picture: string | null;
}

export class ProfileNameRequest {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    example: 'My New Name',
  })
  name: string;
}

export class ProfileStatusRequest {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({
    example: '๐ŸŽ‰ Hey there! I am using WhatsApp ๐ŸŽ‰',
  })
  status: string;
}

@ApiExtraModels(RemoteFile, BinaryFile)
export class ProfilePictureRequest {
  @ApiProperty({
    oneOf: [
      { $ref: getSchemaPath(RemoteFile) },
      { $ref: getSchemaPath(BinaryFile) },
    ],
  })
  file: BinaryFile | RemoteFile;
}