aboutsummaryrefslogtreecommitdiff
path: root/api/api.ts
blob: a2a1e954f7b5fbd852f5187f79fab28a1e37be8e (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
65
66
67
68
69
70
71
72
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;
};

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

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';
}

export interface serverStatus {
	games: number;
	version: {
		commit: string;
		number: string;
	};
}