File size: 1,671 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
import { ApiProperty } from '@nestjs/swagger';
import { S3MediaData } from '@waha/structures/media.s3.dto';

export class WAMedia {
  @ApiProperty({
    description: 'The URL for the media in the message if any',
    example:
      'http://localhost:3000/api/files/false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA.oga',
  })
  url?: string;

  @ApiProperty({
    description: 'mimetype for the media in the message if any',
    example: 'audio/jpeg',
  })
  mimetype?: string;

  @ApiProperty({
    description: 'The original filename in mediaUrl in the message if any',
    example: 'example.pdf',
  })
  filename?: string;

  @ApiProperty({
    description:
      'S3 attributes for the media in the message ' +
      'if you are using S3 media storage',
  })
  s3?: S3MediaData;

  @ApiProperty({
    description: "Error message if there's an error downloading the media",
    example: null,
  })
  // eslint-disable-next-line @typescript-eslint/ban-types
  error?: object;
}

export class FileDTO {
  @ApiProperty({
    description: 'The URL for the file',
  })
  url?: string;

  @ApiProperty({
    description: 'Base64 content of the file',
    example: null,
  })
  data?: string;
}

export class VoiceFileDTO extends FileDTO {
  @ApiProperty({
    description: 'The URL for the voice file',
    example:
      process.env.WHATSAPP_SWAGGER_VIDEO_EXAMPLE_URL ||
      'https://github.com/devlikeapro/waha/raw/core/examples/voice.mp3',
  })
  url?: string;
}

export class VideoFileDTO extends FileDTO {
  @ApiProperty({
    description: 'The URL for the video file',
    example: 'https://github.com/devlikeapro/waha/raw/core/examples/video.mp4',
  })
  url?: string;
}