import { fetch, FormData } from 'undici'; /** * Users defined question when they register this account * * The question id, content mapping is: * * 1. What is your favorite pet's name? * 2. What is your favorite movie? * 3. What is your favorite author's last name? * 4. What is your favorite artist's last name? * 5. What is your favorite actor's last name? * 6. What is your favorite activity? * 7. What is your favorite restaurant? * 8. What is the name of your favorite cartoon? * 9. What is the name of the first school you attended? * 10. What is the last name of your favorite teacher? * 11. What is your best friend's first name? * 12. What is your favorite cousin's name? * 13. What was the first name of your first girl/boyfriend? * 14. What was the name of your first stuffed animal? * 15. What is your mother's middle name? * 16. What is your father's middle name? * 17. What is your oldest sibling's middle name? * 18. In what city did your parents meet? * 19. In what hospital were you born? * 20. What is your favorite team? * 21. How old were you when you got your first computer? * 22. How old were you when you got your first gaming console? * 23. What was your first video game? * 24. What is your favorite card game? * 25. What is your favorite board game? * 26. What was your first gaming console? * 27. What was the first book you ever read? * 28. Where did you go on your first holiday? * 29. In what city does your grandmother live? * 30. In what city does your grandfather live? * 31. What is your grandmother's first name? * 32. What is your grandfather's first name? * 33. What is your least favorite food? * 34. What is your favorite ice cream flavor? * 35. What is your favorite ice cream flavor? * 36. What is your favorite place to visit? * 37. What is your dream job? * 38. What color was your first pet? * 39. What is your lucky number?s * */ export interface MojangChallenge { readonly answer: { id: number; }; readonly question: { id: number; question: string; }; } export interface MojangChallengeResponse { id: number; answer: string; } export interface MinecraftProfileResponse { id: string; name: string; skins: [ { id: string; state: 'ACTIVE' | 'string'; url: string; variant: 'CLASSIC' | string; alias: 'STEVE' | string; } ]; capes: [ { id: string; state: 'ACTIVE' | string; url: string; } ]; } export interface MinecraftOwnershipResponse { /** * If the account doesn't own the game, the items array will be empty. */ items: Array<{ name: 'product_minecraft' | 'game_minecraft'; /** * jwt signature */ signature: string; }>; /** * jwt signature */ signature: string; keyId: string; } export interface MinecraftProfileErrorResponse { path: '/minecraft/profile'; errorType: 'NOT_FOUND' | string; error: string | 'NOT_FOUND'; errorMessage: string; developerMessage: string; } export interface MojangSkin { id: string; state: 'ACTIVE' | 'INACTIVE'; url: string; variant: 'SLIM' | 'CLASSIC'; } export interface MojangCape { id: string; state: 'ACTIVE' | 'INACTIVE'; url: string; /** * Capes name */ alias: string; } export interface MicrosoftMinecraftProfile { id: string; name: string; skins: MojangSkin[]; capes: MojangCape[]; } export interface NameChangeInformation { changedAt: string; createdAt: string; nameChangeAllowed: boolean; } export declare enum NameAvailability { DUPLICATE = "DUPLICATE", AVAILABLE = "AVAILABLE", NOT_ALLOWED = "NOT_ALLOWED" } export declare class SetNameError extends Error { path: string; errorType: string; error: string; details: object; errorMessage: string; developerMessage: string; constructor(message: string, err: any); } export declare class SetSkinError extends Error { path: string; errorType: string; error: string; details: object; errorMessage: string; developerMessage: string; constructor(message: string, err: any); } export declare class MojangError extends Error { path: string; errorMessage: string; developerMessage: string; constructor(err: any); } export declare class UnauthorizedError extends MojangError { name: string; constructor(err: any); } export declare class ProfileNotFoundError extends MojangError { name: string; constructor(err: any); } export interface MojangClientOptions { fetch?: typeof fetch; FormData?: typeof FormData; File?: typeof File; } /** * The mojang api client. Please referece https://wiki.vg/Mojang_API. * * All the apis need user to authenticate the access token from microsoft. * @see {@link MicrosoftAuthenticator} */ export declare class MojangClient { private fetch; protected FormData: typeof FormData; protected File: typeof File; constructor(options?: MojangClientOptions); setName(name: string, token: string, signal?: AbortSignal): Promise; getNameChangeInformation(token: string): Promise; checkNameAvailability(name: string, token: string, signal?: AbortSignal): Promise; getProfile(token: string, signal?: AbortSignal): Promise; setSkin(fileName: string, skin: string | Buffer, variant: 'slim' | 'classic', token: string, signal?: AbortSignal): Promise; resetSkin(token: string, signal?: AbortSignal): Promise; hideCape(token: string, signal?: AbortSignal): Promise; showCape(capeId: string, token: string, signal?: AbortSignal): Promise; verifySecurityLocation(token: string, signal?: AbortSignal): Promise; getSecurityChallenges(token: string): Promise; submitSecurityChallenges(answers: MojangChallengeResponse[], token: string): Promise; /** * Return the owner ship list of the player with those token. */ checkGameOwnership(token: string, signal?: AbortSignal): Promise; /** * Fetch the friends list of the current authenticated player. * * Returns `friends`, `incomingRequests` and `outgoingRequests` arrays. * * Throws {@link UnauthorizedError} on 401, {@link MojangFriendsError} on other failures. */ getFriends(token: string, etag?: string, signal?: AbortSignal): Promise; /** * Add a friend either by Minecraft username or by profile uuid. * * If both are provided, `name` takes precedence. */ addFriend(token: string, target: { name?: string; profileId?: string; }, signal?: AbortSignal): Promise; /** * Remove a friend (or decline an incoming request, or revoke an outgoing * request) by profile uuid or username. */ removeFriend(token: string, target: { name?: string; profileId?: string; }, signal?: AbortSignal): Promise; private updateFriend; /** * Update the player's friend-related preferences. */ updatePlayerAttributes(token: string, prefs: { friendsEnabled?: boolean; acceptInvites?: boolean; }, signal?: AbortSignal): Promise; /** * Fetch the player's attributes (including friends preferences). */ getPlayerAttributes(token: string, signal?: AbortSignal): Promise; } export interface MojangFriendProfile { /** * The profile uuid (with hyphens stripped, normalized). */ profileId: string; /** * The Minecraft player name. */ name: string; /** * Optional ISO-8601 timestamp from the server (when the friendship was added * or when the request was made / expires). */ addedAt?: string; expiresAt?: string; } export interface MojangFriendsListResponse { friends: MojangFriendProfile[]; incomingRequests: MojangFriendProfile[]; outgoingRequests: MojangFriendProfile[]; /** * The etag returned by the server. Used for `If-None-Match` to skip * unchanged responses (the server replies with 304 in that case). */ etag?: string; } export interface MojangPlayerAttributes { privileges?: Record; profanityFilterPreferences?: { profanityFilterOn: boolean; }; banStatus?: unknown; friendsPreferences?: { friends?: 'ENABLED' | 'DISABLED'; acceptInvites?: 'ENABLED' | 'DISABLED'; }; } export declare class MojangFriendsError extends Error { name: string; /** * The original error payload returned by the server, when available. */ details?: any; status: number; /** * Sub-status from the `details.status` field on 400 responses (e.g. * `UNKNOWN_PROFILE`, `CANNOT_ADD_SELF`, `DUPLICATED_PROFILES`). */ subStatus?: string; constructor(message: string, status: number, payload: any); } //# sourceMappingURL=mojang.d.ts.map