114 lines
2.9 KiB
TypeScript
114 lines
2.9 KiB
TypeScript
type Int = number
|
|
type Float = number
|
|
type String = string
|
|
type Boolean = boolean
|
|
type Json = Record<string, unknown>
|
|
|
|
export type Fields<in Q extends (...args: any) => any> = {
|
|
query: ReturnType<Q>[]
|
|
level: number
|
|
}
|
|
export type Fn<F extends (...args: any) => any> = (
|
|
fields: ReturnType<F>,
|
|
) => void
|
|
|
|
/** Media list sort enums */
|
|
export enum MediaListSort {
|
|
MEDIA_ID = "MEDIA_ID",
|
|
MEDIA_ID_DESC = "MEDIA_ID_DESC",
|
|
SCORE = "SCORE",
|
|
SCORE_DESC = "SCORE_DESC",
|
|
STATUS = "STATUS",
|
|
STATUS_DESC = "STATUS_DESC",
|
|
PROGRESS = "PROGRESS",
|
|
PROGRESS_DESC = "PROGRESS_DESC",
|
|
PROGRESS_VOLUMES = "PROGRESS_VOLUMES",
|
|
PROGRESS_VOLUMES_DESC = "PROGRESS_VOLUMES_DESC",
|
|
REPEAT = "REPEAT",
|
|
REPEAT_DESC = "REPEAT_DESC",
|
|
PRIORITY = "PRIORITY",
|
|
PRIORITY_DESC = "PRIORITY_DESC",
|
|
STARTED_ON = "STARTED_ON",
|
|
STARTED_ON_DESC = "STARTED_ON_DESC",
|
|
FINISHED_ON = "FINISHED_ON",
|
|
FINISHED_ON_DESC = "FINISHED_ON_DESC",
|
|
ADDED_TIME = "ADDED_TIME",
|
|
ADDED_TIME_DESC = "ADDED_TIME_DESC",
|
|
UPDATED_TIME = "UPDATED_TIME",
|
|
UPDATED_TIME_DESC = "UPDATED_TIME_DESC",
|
|
MEDIA_TITLE_ROMAJI = "MEDIA_TITLE_ROMAJI",
|
|
MEDIA_TITLE_ROMAJI_DESC = "MEDIA_TITLE_ROMAJI_DESC",
|
|
MEDIA_TITLE_ENGLISH = "MEDIA_TITLE_ENGLISH",
|
|
MEDIA_TITLE_ENGLISH_DESC = "MEDIA_TITLE_ENGLISH_DESC",
|
|
MEDIA_TITLE_NATIVE = "MEDIA_TITLE_NATIVE",
|
|
MEDIA_TITLE_NATIVE_DESC = "MEDIA_TITLE_NATIVE_DESC",
|
|
MEDIA_POPULARITY = "MEDIA_POPULARITY",
|
|
MEDIA_POPULARITY_DESC = "MEDIA_POPULARITY_DESC",
|
|
}
|
|
|
|
/** 8 digit long date integer (YYYYMMDD). Unknown dates represented by 0. */
|
|
export type FuzzyDateInt = string
|
|
|
|
/** Thread comments sort enums */
|
|
export enum ThreadCommentSort {
|
|
ID = "ID",
|
|
ID_DESC = "ID_DESC",
|
|
}
|
|
|
|
/** Media list scoring type */
|
|
export enum ScoreFormat {
|
|
/** An integer from 0-100 */
|
|
POINT_100 = "POINT_100",
|
|
/** A float from 0-10 with 1 decimal place */
|
|
POINT_10_DECIMAL = "POINT_10_DECIMAL",
|
|
/** An integer from 0-10 */
|
|
POINT_10 = "POINT_10",
|
|
/** An integer from 0-5. Should be represented in Stars */
|
|
POINT_5 = "POINT_5",
|
|
/** An integer from 0-3. Should be represented in Smileys. 0 => No Score, 1 => :(, 2 => :|, 3 => :) */
|
|
POINT_3 = "POINT_3",
|
|
}
|
|
|
|
export type Variables = { [arg: string]: string | number | boolean | string[] }
|
|
|
|
export type UpdateQuery = {
|
|
query?: string
|
|
variables?: any
|
|
field: string[]
|
|
level: number
|
|
hasSubField?: true
|
|
}
|
|
|
|
export type Authorization = {
|
|
token_type: string
|
|
expires_in: number
|
|
access_token: string
|
|
/** Currently not used for anything */
|
|
refresh_token: string
|
|
}
|
|
|
|
export type Fetch = {
|
|
(
|
|
init:
|
|
& Record<
|
|
| "code"
|
|
| "client_id"
|
|
| "client_secret"
|
|
| "redirect_uri",
|
|
string
|
|
>
|
|
& { "grant_type"?: "authorization_code" },
|
|
): Promise<Authorization>
|
|
(
|
|
init: { query: string; token?: string },
|
|
): Promise<Response>
|
|
}
|
|
|
|
// export type Fields = (Readonly<
|
|
// [string] | [string, true] | [string, true, Fields]
|
|
// >)[]
|
|
|
|
export type Response<T = Record<string, any>> = {
|
|
data: T
|
|
}
|