All checks were successful
ci/woodpecker/push/ci Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
123 lines
3.5 KiB
TypeScript
123 lines
3.5 KiB
TypeScript
import {
|
|
ArrayNotEmpty,
|
|
IsArray,
|
|
IsBoolean,
|
|
IsNotEmpty,
|
|
IsObject,
|
|
IsOptional,
|
|
IsString,
|
|
IsUrl,
|
|
MaxLength,
|
|
MinLength,
|
|
} from "class-validator";
|
|
|
|
export class CreateProviderDto {
|
|
@IsString({ message: "name must be a string" })
|
|
@IsNotEmpty({ message: "name is required" })
|
|
@MaxLength(100, { message: "name must not exceed 100 characters" })
|
|
name!: string;
|
|
|
|
@IsString({ message: "displayName must be a string" })
|
|
@IsNotEmpty({ message: "displayName is required" })
|
|
@MaxLength(255, { message: "displayName must not exceed 255 characters" })
|
|
displayName!: string;
|
|
|
|
@IsString({ message: "type must be a string" })
|
|
@IsNotEmpty({ message: "type is required" })
|
|
@MaxLength(100, { message: "type must not exceed 100 characters" })
|
|
type!: string;
|
|
|
|
@IsOptional()
|
|
@IsUrl(
|
|
{ require_tld: false },
|
|
{ message: "baseUrl must be a valid URL (for example: https://api.example.com/v1)" }
|
|
)
|
|
baseUrl?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "apiKey must be a string" })
|
|
apiKey?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "apiType must be a string" })
|
|
@MaxLength(100, { message: "apiType must not exceed 100 characters" })
|
|
apiType?: string;
|
|
|
|
@IsOptional()
|
|
@IsArray({ message: "models must be an array" })
|
|
@IsObject({ each: true, message: "each model must be an object" })
|
|
models?: Record<string, unknown>[];
|
|
}
|
|
|
|
export class UpdateProviderDto {
|
|
@IsOptional()
|
|
@IsString({ message: "displayName must be a string" })
|
|
@MaxLength(255, { message: "displayName must not exceed 255 characters" })
|
|
displayName?: string;
|
|
|
|
@IsOptional()
|
|
@IsUrl(
|
|
{ require_tld: false },
|
|
{ message: "baseUrl must be a valid URL (for example: https://api.example.com/v1)" }
|
|
)
|
|
baseUrl?: string;
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "apiKey must be a string" })
|
|
apiKey?: string;
|
|
|
|
@IsOptional()
|
|
@IsBoolean({ message: "isActive must be a boolean" })
|
|
isActive?: boolean;
|
|
|
|
@IsOptional()
|
|
@IsArray({ message: "models must be an array" })
|
|
@IsObject({ each: true, message: "each model must be an object" })
|
|
models?: Record<string, unknown>[];
|
|
}
|
|
|
|
export class UpdateAgentConfigDto {
|
|
@IsOptional()
|
|
@IsString({ message: "primaryModel must be a string" })
|
|
@MaxLength(255, { message: "primaryModel must not exceed 255 characters" })
|
|
primaryModel?: string;
|
|
|
|
@IsOptional()
|
|
@IsArray({ message: "fallbackModels must be an array" })
|
|
@ArrayNotEmpty({ message: "fallbackModels cannot be empty" })
|
|
@IsString({ each: true, message: "each fallback model must be a string" })
|
|
fallbackModels?: string[];
|
|
|
|
@IsOptional()
|
|
@IsString({ message: "personality must be a string" })
|
|
personality?: string;
|
|
}
|
|
|
|
export class UpdateOidcDto {
|
|
@IsString({ message: "issuerUrl must be a string" })
|
|
@IsNotEmpty({ message: "issuerUrl is required" })
|
|
@IsUrl(
|
|
{ require_tld: false },
|
|
{ message: "issuerUrl must be a valid URL (for example: https://issuer.example.com)" }
|
|
)
|
|
issuerUrl!: string;
|
|
|
|
@IsString({ message: "clientId must be a string" })
|
|
@IsNotEmpty({ message: "clientId is required" })
|
|
clientId!: string;
|
|
|
|
@IsString({ message: "clientSecret must be a string" })
|
|
@IsNotEmpty({ message: "clientSecret is required" })
|
|
clientSecret!: string;
|
|
}
|
|
|
|
export class ResetPasswordDto {
|
|
@IsString({ message: "username must be a string" })
|
|
@IsNotEmpty({ message: "username is required" })
|
|
username!: string;
|
|
|
|
@IsString({ message: "newPassword must be a string" })
|
|
@MinLength(8, { message: "newPassword must be at least 8 characters" })
|
|
newPassword!: string;
|
|
}
|