Spaces:
Runtime error
Runtime error
File size: 2,159 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 |
import { ApiExtraModels, ApiProperty, getSchemaPath } from '@nestjs/swagger';
import { ConvertApiProperty } from '@waha/structures/properties.dto';
import {
BinaryFile,
RemoteFile,
VideoBinaryFile,
VideoRemoteFile,
VoiceBinaryFile,
VoiceRemoteFile,
} from './files.dto';
export const BROADCAST_ID = 'status@broadcast';
const ContactsProperty = ApiProperty({
description: 'Contact list to send the status to.',
example: null,
required: false,
});
export class StatusRequest {
@ApiProperty({
description: 'Pre-generated status message id',
example: 'BBBBBBBBBBBBBBBBB',
default: null,
required: false,
})
id?: string;
@ContactsProperty
contacts?: string[];
}
export class TextStatus extends StatusRequest {
text: string = 'Have a look! https://github.com/';
backgroundColor: string = '#38b42f';
font: number = 0;
linkPreview?: boolean = true;
linkPreviewHighQuality?: boolean = false;
}
@ApiExtraModels(RemoteFile, BinaryFile)
export class ImageStatus extends StatusRequest {
@ApiProperty({
oneOf: [
{ $ref: getSchemaPath(RemoteFile) },
{ $ref: getSchemaPath(BinaryFile) },
],
})
file: RemoteFile | BinaryFile;
caption?: string;
}
@ApiExtraModels(VoiceRemoteFile, VoiceBinaryFile)
export class VoiceStatus extends StatusRequest {
@ApiProperty({
oneOf: [
{ $ref: getSchemaPath(VoiceRemoteFile) },
{ $ref: getSchemaPath(VoiceBinaryFile) },
],
})
file: VoiceRemoteFile | VoiceBinaryFile;
backgroundColor: string = '#38b42f';
@ConvertApiProperty()
convert: boolean;
}
@ApiExtraModels(VideoRemoteFile, VideoBinaryFile)
export class VideoStatus extends StatusRequest {
@ApiProperty({
oneOf: [
{ $ref: getSchemaPath(VideoRemoteFile) },
{ $ref: getSchemaPath(VideoBinaryFile) },
],
})
file: VideoRemoteFile | VideoBinaryFile;
caption?: string;
@ConvertApiProperty()
convert: boolean;
}
export class DeleteStatusRequest extends StatusRequest {
@ApiProperty({
description: 'Status message id to delete',
example: 'AAAAAAAAAAAAAAAAA',
})
id: string;
@ContactsProperty
contacts?: string[];
}
|