30 lines
626 B
JavaScript
30 lines
626 B
JavaScript
import { Client } from "./client.js";
|
|
|
|
class Profile
|
|
{
|
|
/**
|
|
* @param {Client} client
|
|
*/
|
|
constructor (client, username = undefined, avatar_url = undefined, user_id = undefined)
|
|
{
|
|
/**
|
|
* @type {Client} client
|
|
*/
|
|
this.client = client;
|
|
this.username = username;
|
|
this.avatar_url = avatar_url
|
|
this.user_id = user_id
|
|
}
|
|
|
|
async init(user_id)
|
|
{
|
|
let response = await this.client._get(`/api/profiles/${user_id}`);
|
|
let response_data = await response.json();
|
|
|
|
this.user_id = response_data.user_id;
|
|
this.username = response_data.username;
|
|
this.avatar_url = response_data.avatar_url;
|
|
}
|
|
}
|
|
|
|
export {Profile} |