@haelp/teto
Version:
A typescript-based controllable TETR.IO client.
87 lines (86 loc) • 2.5 kB
TypeScript
import { APIDefaults } from ".";
import { User as UserTypes } from "../../types";
import type { Get, Post } from "./basic";
export declare namespace Users {
/** Data returned from /api/users/me */
interface Me {
_id: string;
username: string;
country: string | null;
email?: string | undefined;
role: UserTypes.Role;
ts: Date;
badges: UserTypes.Badge[];
xp: number;
privacy_showwon: boolean;
privacy_showplayed: boolean;
privacy_showgametime: boolean;
privacy_showcountry: boolean;
privacy_privatemode: string;
privacy_status_shallow: string;
privacy_status_deep: string;
privacy_status_exact: string;
privacy_dm: string;
privacy_invite: string;
thanked: boolean;
banlist: any[];
warnings: any[];
bannedstatus: string;
records?: UserTypes.Records;
supporter: boolean;
supporter_expires: number;
total_supported: number;
league: UserTypes.League;
avatar_revision?: number;
banner_revision?: number;
bio?: string;
zen?: any;
distinguishment?: any;
totp: {
enabled?: boolean;
codes_remaining: number;
};
connections: {
[key: string]: any;
};
}
interface User {
_id: string;
username: string;
role: string;
ts: string;
badges: UserTypes.Badge[];
xp: number;
gamesplayed: number;
gameswon: number;
gametime: number;
country: string;
badstanding: boolean;
records: UserTypes.Records;
supporter: boolean;
supporter_tier: number;
verified: boolean;
league: UserTypes.League;
avatar_revision: number;
banner_revision: number;
bio: string;
friendCount: number;
friendedYou: boolean;
}
}
export declare const users: (get: Get, post: Post, __: APIDefaults) => {
/** Checks whether a user exists */
exists: (username: string) => Promise<boolean>;
authenticate: (username: string, password: string) => Promise<{
token: string;
id: string;
}>;
me: () => Promise<Users.Me>;
resolve: (username: string) => Promise<string>;
/** Get a user's profile */
get: (options: {
username: string;
} | {
id: string;
}) => Promise<Users.User>;
};