44 lines
2.3 KiB
TypeScript
44 lines
2.3 KiB
TypeScript
|
|
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"
|
||
|
|
|
||
|
|
import { AssetVariantResponseDto } from "./asset-response.dto"
|
||
|
|
|
||
|
|
export class CreateAssetVariantsRequestDto {
|
||
|
|
@ApiProperty({ description: "Preset для генерации или `custom`.", example: "card" })
|
||
|
|
preset!: string
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Режим генерации: один variant или вся family preset.", enum: ["single", "family"], example: "single" })
|
||
|
|
mode?: "family" | "single"
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Версия source image. Если не передана, используется currentVersion asset.", example: 1 })
|
||
|
|
version?: number
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Ширина variant. Обязательна для responsive preset в mode=`single` и custom.", example: 640 })
|
||
|
|
width?: number
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Высота variant для custom. `0` или отсутствие означает auto height.", example: 333 })
|
||
|
|
height?: number
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Качество. Если не передано, берётся из preset/custom config.", example: 80 })
|
||
|
|
quality?: number
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Фактический формат для single generation.", enum: ["avif", "webp", "jpg", "png"], example: "webp" })
|
||
|
|
format?: "avif" | "jpg" | "png" | "webp"
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Форматы для family generation. Если не переданы, используются все форматы preset.", enum: ["avif", "webp", "jpg", "png"], isArray: true })
|
||
|
|
formats?: Array<"avif" | "jpg" | "png" | "webp">
|
||
|
|
|
||
|
|
@ApiPropertyOptional({ description: "Resize mode для custom transforms.", enum: ["fit", "fill"], example: "fill" })
|
||
|
|
resize?: "fill" | "fit"
|
||
|
|
}
|
||
|
|
|
||
|
|
export class CreateAssetVariantsResponseDto {
|
||
|
|
@ApiProperty({ description: "Публичный идентификатор asset.", example: "asset_demo" })
|
||
|
|
publicId!: string
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Версия source image, для которой поставлены jobs.", example: 1 })
|
||
|
|
version!: number
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Созданные или переиспользованные variants.", type: [AssetVariantResponseDto] })
|
||
|
|
variants!: AssetVariantResponseDto[]
|
||
|
|
}
|