tmemory
Version:
A terminal-based Memory card game built with React Ink. Features multiple grid sizes, AI opponent, and high scores.
36 lines (35 loc) • 1.21 kB
TypeScript
export interface Score {
playerName: string;
deviceId: string;
time: number;
rows: number;
cols: number;
gameMode: string;
date: string;
verified?: boolean;
}
/**
* Submits a score to the API server.
*
* @param score - The score object to be submitted to the server
* @returns A Promise that resolves to the parsed JSON response from the server
* @throws Error When the server responds with a non-OK status, with details about the failure
*/
export declare function submitScore(score: Score): Promise<any>;
/**
* Fetch the leaderboard from the API using optional filters.
*
* @param filters - An optional object containing filtering criteria:
* - gameMode: (optional) Specifies the game mode to filter scores.
* - rows: (optional) Specifies the number of rows to filter the leaderboard.
* - cols: (optional) Specifies the number of columns to filter the leaderboard.
*
* @returns A promise that resolves with the JSON response of the leaderboard data.
*
* @throws Will throw an error if the response from the API is not ok.
*/
export declare function fetchLeaderboard(filters?: {
gameMode?: string;
rows?: number;
cols?: number;
}): Promise<any>;