aboutsummaryrefslogtreecommitdiff
path: root/api/api.ts
blob: 320df922f4fcef7634f5b34bfd60894235a3183d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
export interface userInfo {
	avatar: string|null,
	status: string|null,
	coutry: string|null,
	id: string,
	registered: number,
	username: string,
	friends: number,
	relation?: "none"|"friends"|"incoming"|"outgoing"|"blocked",
	rating: number,
};

export type ruleset = {
	timelimit: {
		enabled: boolean;
		minutes: number;
		seconds: number;
		addmove: number;
		shared: boolean;
	},
	ranked: boolean;
}

export type userColors = {
	diskA: string;
	diskB: string;
	background: string;
}

export interface userPreferences {
	darkMode?: boolean;
	ruleset?: ruleset;
	userColors?: userColors;
}

export interface userGameTotals {
    draw: number;
    games: number;
    lose: number;
    win: number;
}

export type outcome = "w" | "l" | "d";

export interface userGames {
	totals: userGameTotals;
	games: Array<gameInfo>;
}

export interface gameInfo {
	created: number;
	duration: number;
	id: string;
	moves: Array<number>;
	opponent?: userInfo;
	outcome: outcome;
	parent?: string;
	private: boolean;
	rating?: number;
	rating_opponent?: number;
	ruleset: ruleset;
	started: number;
	status: "finished"|"in_progress"|"resign"|"wait_for_opponent";
}