Merge pull request #60 from Suyashtnt/better-ts

Added docs for types. Thanks, Tabs!
This commit is contained in:
Pierce 2021-01-18 14:05:19 -05:00 committed by GitHub
commit 63e810a685
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 209 additions and 107 deletions

110
index.d.ts vendored
View file

@ -25,34 +25,114 @@ declare module "minecraft-launcher-core" {
} }
interface ILauncherOptions { interface ILauncherOptions {
/**
* Path or URL to the client package zip file.
*/
clientPackage?: string; clientPackage?: string;
/**
* if true MCLC will remove the client package zip file after its finished extracting.
*/
removePackage?: boolean; removePackage?: boolean;
/**
* Path to installer being executed.
*/
installer?: string; installer?: string;
/**
* Path where you want the launcher to work in.
* This will usually be your .minecraft folder
*/
root: string; root: string;
/**
* OS override for minecraft natives
*
* @default will autodetect
*/
os?: OS; os?: OS;
/**
* Array of custom Minecraft arguments.
*/
customLaunchArgs?: Array<string>; customLaunchArgs?: Array<string>;
/**
* Array of custom Java arguments
*/
customArgs?: Array<string>; customArgs?: Array<string>;
/**
* minecraft version info
*/
version: { version: {
/**
* Actual version.
*
* @example '1.16.4'
*/
number: string; number: string;
type: string; /**
* type of release, usually `release` or `snapshot`
*/
type: 'release' | 'snapshot' | string;
/**
* The name of the folder, jar file, and version json in the version folder.
*
* ` MCLC will look in the `versions` folder for this name
* @example '1.16.4-fabric'
*/
custom?: string; custom?: string;
}; };
memory: { memory: {
/**
* Min amount of memory being used by Minecraft.
*/
max: string | number; max: string | number;
/**
* Max amount of memory being used by Minecraft.
*/
min: string | number; min: string | number;
}; };
/**
* Path to Forge Jar.
*
* Versions below 1.13 should be the "universal" jar while versions above 1.13+ should be the "installer" jar
*/
forge?: string; forge?: string;
/**
* Path to the JRE executable file, will default to java if not entered.
*/
javaPath?: string; javaPath?: string;
server?: { server?: {
/**
* Host url to the server, don't include the port.
*/
host: string; host: string;
port: string; /**
* Port of the host url
*
* @default 25565
*/
port?: string;
}; };
proxy?: { proxy?: {
/**
* Host url to the proxy, don't include the port.
*/
host: string; host: string;
port: string; /**
* Username for the proxy.
*
* @default 8080
*/
port?: string;
/**
* Username for the proxy.
*/
username?: string; username?: string;
/**
* Password for the proxy.
*/
password?: string; password?: string;
}; };
/**
* Timeout on download requests.
*/
timeout?: number; timeout?: number;
window?: { window?: {
width?: number; width?: number;
@ -77,20 +157,43 @@ declare module "minecraft-launcher-core" {
} }
interface IAuthenticator { interface IAuthenticator {
/**
* @param username email if using a password, else the username
* @param password password for mojang account
*/
getAuth(username: string, password?: string): Promise<IUser>; getAuth(username: string, password?: string): Promise<IUser>;
/**
*
* @param access_token Token being checked if it can be used to login with (online mode)
* @param client_token Client token being checked to see if there was a change of client (online mode)
*/
validate( validate(
access_token: string, access_token: string,
client_token: string client_token: string
): Promise<boolean | Partial<any>>; ): Promise<boolean | Partial<any>>;
/**
*
* @param access_token Token being checked if it can be used to login with (online mode)
* @param client_token Client token being checked to see if there was a change of client (online mode)
*/
refreshAuth( refreshAuth(
access_token: string, access_token: string,
client_token: string, client_token: string,
selectedProfile: IProfile selectedProfile: IProfile
): Promise<IUser>; ): Promise<IUser>;
/**
*
* @param access_token Token being checked if it can be used to login with (online mode)
* @param client_token Client token being checked to see if there was a change of client (online mode)
*/
invalidate( invalidate(
access_token: string, access_token: string,
client_token: string client_token: string
): Promise<boolean | Partial<any>>; ): Promise<boolean | Partial<any>>;
/**
* @param username email if using a password, else the username
* @param password password for mojang account
*/
signOut( signOut(
username: string, username: string,
password: string password: string
@ -107,4 +210,3 @@ declare module "minecraft-launcher-core" {
export const Authenticator: IAuthenticator; export const Authenticator: IAuthenticator;
} }

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "3.14.6", "version": "3.16.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {