mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: some more docs
This commit is contained in:
1 parent
5feec9bf1e
commit
551108e047
8 files changed
+45
-7
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import type { Strings } from "@blitzkit/i18n";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import type { Avatar } from "../../protos/avatar";
|
||||
import type { AvatarList } from "../../protos/avatar_list";
|
||||
import type { Avatars } from "../../protos/avatars";
|
||||
import type { Background } from "../../protos/background";
|
||||
import type { Backgrounds } from "../../protos/backgrounds";
|
||||
@@ -130,6 +131,16 @@ export abstract class AbstractAPI {
|
||||
return this._avatarsCache;
|
||||
}
|
||||
|
||||
private _avatarListCache: AvatarList | undefined;
|
||||
protected abstract _avatarList(): Promise<AvatarList>;
|
||||
async avatarList() {
|
||||
if (this._avatarListCache === undefined) {
|
||||
this._avatarListCache = await this._avatarList();
|
||||
}
|
||||
|
||||
return this._avatarListCache;
|
||||
}
|
||||
|
||||
private _backgroundCache: Record<string, Background> = {};
|
||||
protected abstract _background(id: string): Promise<Background>;
|
||||
async background(id: string) {
|
||||
|
||||
@@ -193,6 +193,13 @@ export class ServerAPI extends AbstractAPI {
|
||||
return { avatars };
|
||||
}
|
||||
|
||||
protected async _avatarList() {
|
||||
const avatars = await this.avatars();
|
||||
const list = Object.keys(avatars.avatars);
|
||||
|
||||
return { list };
|
||||
}
|
||||
|
||||
protected async _avatar(id: string) {
|
||||
const avatar = this.metadata.item(`ProfileAvatarEntity.${id}`);
|
||||
const name = avatar.name;
|
||||
|
||||
Reference in new issue
Block a user