add: game history
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { Client } from "./Client.js";
|
||||
import { Game } from "./game/Game.js";
|
||||
|
||||
class Profile
|
||||
{
|
||||
@ -59,6 +60,36 @@ class Profile
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {[Game]}
|
||||
*/
|
||||
async getGameHistory()
|
||||
{
|
||||
let response = await this.client._get(`/api/games/history/${this.id}`);
|
||||
let response_data = await response.json();
|
||||
|
||||
let games = [];
|
||||
|
||||
response_data.forEach(game_data => {
|
||||
games.push(new Game(this.client,
|
||||
game_data.id,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
game_data.winner_id,
|
||||
game_data.state,
|
||||
game_data.started,
|
||||
game_data.finished,
|
||||
game_data.players,
|
||||
game_data.start_timestamp,
|
||||
game_data.stop_timestamp
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return games;
|
||||
}
|
||||
|
||||
async getBlock() {
|
||||
let block_response = await this.client._get("/api/profiles/block");
|
||||
|
||||
|
Reference in New Issue
Block a user