mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 22:10:24 +00:00
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import * as Yup from 'yup'
|
|
import YupKorean from 'yup-locales-ko'
|
|
import { ListType } from '../types'
|
|
|
|
Yup.setLocale(YupKorean)
|
|
|
|
export const botListArgumentSchema = Yup.object({
|
|
type: Yup.string().oneOf(['VOTE', 'TRUSTED', 'NEW', 'PARTNERED', 'CATEGORY', 'SEARCH']).required(),
|
|
page: Yup.number().positive().integer().notRequired().default(1),
|
|
query: Yup.string().notRequired()
|
|
})
|
|
|
|
export interface botListArgument {
|
|
type: ListType
|
|
page?: number
|
|
query?: string
|
|
}
|
|
|
|
export const ImageOptionsSchema: Yup.SchemaOf<ImageOptions> = Yup.object({
|
|
id: Yup.string().required(),
|
|
ext: Yup.mixed<ext>().oneOf(['webp', 'png', 'gif']).required(),
|
|
size: Yup.mixed<ImageSize>().oneOf(['128', '256', '512']).required()
|
|
})
|
|
|
|
interface ImageOptions {
|
|
id: string
|
|
ext: ext
|
|
size: ImageSize
|
|
}
|
|
|
|
type ext = 'webp' | 'png' | 'gif'
|
|
type ImageSize = '128' | '256' | '512'
|
|
|
|
export const PageCount = Yup.number().integer().positive()
|
|
|
|
export const OauthCallbackSchema: Yup.SchemaOf<OauthCallback> = Yup.object({
|
|
code: Yup.string().required()
|
|
})
|
|
|
|
interface OauthCallback {
|
|
code: string
|
|
}
|
|
|
|
|
|
export default Yup |