import { IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator"; import { StatsClient } from '../entities/StatsClient'; import { ResponseObjectType } from '../enums/ResponseObjectType'; import { IResponse } from './IResponse'; /** * Defines the statsClient response. */ export class ResponseStatsClient implements IResponse { /** * The responseType. * This contains the type of class/entity this response contains. */ responseType: ResponseObjectType = ResponseObjectType.STATSCLIENT; /** * The client's id. */ @IsInt() id: number; /** * The client's description. */ @IsString() @IsOptional() description?: string; /** * The client's api key. * Only visible on creation or regeneration. */ @IsString() @IsOptional() key: string; /** * The client's api key prefix. */ @IsString() @IsNotEmpty() prefix: string; /** * Creates a ResponseStatsClient object from a statsClient. * @param client The statsClient the response shall be build for. */ public constructor(client: StatsClient) { this.id = client.id; this.description = client.description; this.prefix = client.prefix; this.key = "Only visible on creation."; } }