160 lines
4.7 KiB
TypeScript
160 lines
4.7 KiB
TypeScript
type Int = number
|
|
type Float = number
|
|
type String = string
|
|
type Boolean = boolean
|
|
type Json = Record<string, unknown>
|
|
|
|
/** 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?: Variables
|
|
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; variables: Variables; token?: string },
|
|
): Promise<Response>
|
|
}
|
|
|
|
export type Fields = (Readonly<
|
|
[string] | [string, true] | [string, true, Fields]
|
|
>)[]
|
|
|
|
export type MediaListArguments = {
|
|
/** Filter by a list entry's id */
|
|
id: number
|
|
/** Filter by a user's id */
|
|
userId: number
|
|
/** Filter by a user's name */
|
|
userName: string
|
|
/** Filter by the list entries media type */
|
|
type: MediaType
|
|
/** Filter by the watching/reading status */
|
|
status: MediaListStatus
|
|
/** Filter by the media id of the list entry */
|
|
mediaId: number
|
|
/** Filter list entries to users who are being followed by the authenticated user */
|
|
isFollowing: boolean
|
|
/** Filter by note words and #tags */
|
|
notes: string
|
|
/** Filter by the date the user started the media */
|
|
startedAt: FuzzyDateInt
|
|
/** Filter by the date the user completed the media */
|
|
completedAt: FuzzyDateInt
|
|
/** Limit to only entries also on the auth user's list. Requires user id or name arguments */
|
|
compareWithAuthList: boolean
|
|
/** Filter by a user's id */
|
|
userId_in: number[]
|
|
/** Filter by the watching/reading status */
|
|
status_in: MediaListStatus[]
|
|
/** Filter by the watching/reading status */
|
|
status_not_in: MediaListStatus[]
|
|
/** Filter by the watching/reading status */
|
|
status_not: MediaListStatus
|
|
/** Filter by the media id of the list entry */
|
|
mediaId_in: number[]
|
|
/** Filter by the media id of the list entry */
|
|
mediaId_not_in: number[]
|
|
/** Filter by note words and #tags */
|
|
notes_like: string
|
|
/** Filter by the date the user started the media */
|
|
startedAt_greater: FuzzyDateInt
|
|
/** Filter by the date the user started the media */
|
|
startedAt_lesser: FuzzyDateInt
|
|
/** Filter by the date the user started the media */
|
|
startedAt_like: string
|
|
/** Filter by the date the user completed the media */
|
|
completedAt_greater: FuzzyDateInt
|
|
/** Filter by the date the user completed the media */
|
|
completedAt_lesser: FuzzyDateInt
|
|
/** Filter by the date the user completed the media */
|
|
completedAt_like: string
|
|
/** The order the results will be returned in */
|
|
sort: MediaListSort[]
|
|
}
|
|
|
|
export type Response<T = Record<string, any>> = {
|
|
data: T
|
|
}
|
|
|