| 1 | import { IsString, IsOptional, IsArray, IsNumber, IsBoolean, IsUrl } from 'class-validator'; |
| 2 | import { ApiProperty } from '@nestjs/swagger'; |
| 3 | |
| 4 | export class CreateVideoDto { |
| 5 | @ApiProperty({ description: 'TikTok账号ID' }) |
| 6 | @IsString() |
| 7 | accountId: string; |
| 8 | |
| 9 | @ApiProperty({ description: '视频描述/标题' }) |
| 10 | @IsString() |
| 11 | description: string; |
| 12 | |
| 13 | @ApiProperty({ description: '视频是否为私有', required: false, default: false }) |
| 14 | @IsBoolean() |
| 15 | @IsOptional() |
| 16 | private?: boolean; |
| 17 | |
| 18 | @ApiProperty({ description: '视频话题标签列表', required: false, type: [String] }) |
| 19 | @IsArray() |
| 20 | @IsOptional() |
| 21 | hashtags?: string[]; |
| 22 | } |
| 23 | |
| 24 | export class TikTokCommentDto { |
| 25 | @ApiProperty({ description: 'TikTok账号ID' }) |
| 26 | @IsString() |
| 27 | accountId: string; |
| 28 | |
| 29 | @ApiProperty({ description: '视频ID' }) |
| 30 | @IsString() |
| 31 | videoId: string; |
| 32 | |
| 33 | @ApiProperty({ description: '评论内容' }) |
| 34 | @IsString() |
| 35 | text: string; |
| 36 | } |
| 37 | |
| 38 | export class GetVideosQueryDto { |
| 39 | @ApiProperty({ description: 'TikTok账号ID' }) |
| 40 | @IsString() |
| 41 | accountId: string; |
| 42 | |
| 43 | @ApiProperty({ description: '每页结果数', required: false, default: 10 }) |
| 44 | @IsNumber() |
| 45 | @IsOptional() |
| 46 | limit?: number; |
| 47 | |
| 48 | @ApiProperty({ description: '用于分页的游标', required: false }) |
| 49 | @IsString() |
| 50 | @IsOptional() |
| 51 | cursor?: string; |
| 52 | } |
| 53 | |
| 54 | export class TikTokVideoFilterDto { |
| 55 | @ApiProperty({ description: 'TikTok账号ID' }) |
| 56 | @IsString() |
| 57 | accountId: string; |
| 58 | |
| 59 | @ApiProperty({ description: '关键词搜索', required: false }) |
| 60 | @IsString() |
| 61 | @IsOptional() |
| 62 | keyword?: string; |
| 63 | |
| 64 | @ApiProperty({ description: '最低播放次数', required: false }) |
| 65 | @IsNumber() |
| 66 | @IsOptional() |
| 67 | minPlayCount?: number; |
| 68 | |
| 69 | @ApiProperty({ description: '每页结果数', required: false, default: 10 }) |
| 70 | @IsNumber() |
| 71 | @IsOptional() |
| 72 | limit?: number; |
| 73 | |
| 74 | @ApiProperty({ description: '用于分页的游标', required: false }) |
| 75 | @IsString() |
| 76 | @IsOptional() |
| 77 | cursor?: string; |
| 78 | } |
| 79 | |
| 80 | export interface TikTokOAuthTokenResponse { |
| 81 | access_token: string; |
| 82 | refresh_token: string; |
| 83 | expires_in: number; |
| 84 | token_type: string; |
| 85 | scope: string; |
| 86 | open_id: string; |
| 87 | } |
| 88 | |
| 89 | export interface TikTokUser { |
| 90 | open_id: string; |
| 91 | union_id: string; |
| 92 | username: string; |
| 93 | display_name: string; |
| 94 | avatar_url: string; |
| 95 | bio_description: string; |
| 96 | profile_deep_link: string; |
| 97 | is_verified: boolean; |
| 98 | follower_count: number; |
| 99 | following_count: number; |
| 100 | likes_count: number; |
| 101 | video_count: number; |
| 102 | } |
| 103 | |
| 104 | export class CombinedVideoUploadDto { |
| 105 | @ApiProperty({ description: 'TikTok账号ID' }) |
| 106 | @IsString() |
| 107 | accountId: string; |
| 108 | |
| 109 | @ApiProperty({ description: '视频标题', required: false }) |
| 110 | @IsString() |
| 111 | @IsOptional() |
| 112 | title?: string; |
| 113 | |
| 114 | @ApiProperty({ description: '视频描述', required: false }) |
| 115 | @IsString() |
| 116 | @IsOptional() |
| 117 | description?: string; |
| 118 | |
| 119 | @ApiProperty({ description: '隐私级别', required: false, default: 'PUBLIC', enum: ['PUBLIC', 'PRIVATE', 'FRIENDS'] }) |
| 120 | @IsString() |
| 121 | @IsOptional() |
| 122 | privacyStatus?: string; |
| 123 | |
| 124 | @ApiProperty({ description: '是否禁用评论', required: false, default: false }) |
| 125 | @IsBoolean() |
| 126 | @IsOptional() |
| 127 | disableComment?: boolean; |
| 128 | |
| 129 | @ApiProperty({ description: '是否禁用二重奏', required: false, default: false }) |
| 130 | @IsBoolean() |
| 131 | @IsOptional() |
| 132 | disableDuet?: boolean; |
| 133 | |
| 134 | @ApiProperty({ description: '是否禁用Stitch', required: false, default: false }) |
| 135 | @IsBoolean() |
| 136 | @IsOptional() |
| 137 | disableStitch?: boolean; |
| 138 | |
| 139 | @ApiProperty({ description: '视频封面时间点(毫秒)', required: false }) |
| 140 | @IsNumber() |
| 141 | @IsOptional() |
| 142 | videoCoverTimestampMs?: number; |
| 143 | |
| 144 | @ApiProperty({ description: '话题标签列表', required: false, type: [String] }) |
| 145 | @IsArray() |
| 146 | @IsOptional() |
| 147 | tags?: string[]; |
| 148 | |
| 149 | @ApiProperty({ description: '轮询间隔(毫秒)', required: false, default: 2000 }) |
| 150 | @IsNumber() |
| 151 | @IsOptional() |
| 152 | pollInterval?: number; |
| 153 | |
| 154 | @ApiProperty({ description: '最大重试次数', required: false, default: 30 }) |
| 155 | @IsNumber() |
| 156 | @IsOptional() |
| 157 | maxRetries?: number; |
| 158 | } |
| 159 |