// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. /** user-defined commands */ /** tauri-specta globals */ import type { WebviewWindow as __WebviewWindow__ } from '@tauri-apps/api/webviewWindow'; import { invoke as TAURI_INVOKE, } from '@tauri-apps/api/core'; import * as TAURI_API_EVENT from '@tauri-apps/api/event'; export const commands = { async getUsers(): Promise, SerializableError>> { try { return { status: 'ok', data: await TAURI_INVOKE('get_users') }; } catch (e) { if (e instanceof Error) throw e; else return { status: 'error', error: e as any }; } }, async getUser(uuid: string): Promise> { try { return { status: 'ok', data: await TAURI_INVOKE('get_user', { uuid }) }; } catch (e) { if (e instanceof Error) throw e; else return { status: 'error', error: e as any }; } }, async removeUser(uuid: string): Promise> { try { return { status: 'ok', data: await TAURI_INVOKE('remove_user', { uuid }) }; } catch (e) { if (e instanceof Error) throw e; else return { status: 'error', error: e as any }; } }, async getDefaultUser(fallback: boolean | null): Promise> { try { return { status: 'ok', data: await TAURI_INVOKE('get_default_user', { fallback }) }; } catch (e) { if (e instanceof Error) throw e; else return { status: 'error', error: e as any }; } }, async setDefaultUser(uuid: string | null): Promise> { try { return { status: 'ok', data: await TAURI_INVOKE('set_default_user', { uuid }) }; } catch (e) { if (e instanceof Error) throw e; else return { status: 'error', error: e as any }; } }, async beginMsFlow(): Promise> { try { return { status: 'ok', data: await TAURI_INVOKE('begin_ms_flow') }; } catch (e) { if (e instanceof Error) throw e; else return { status: 'error', error: e as any }; } }, async openDevTools(): Promise { await TAURI_INVOKE('open_dev_tools'); }, }; /** user-defined events */ export const events = __makeEvents__<{ launcherEvent: LauncherEvent; }>({ launcherEvent: 'launcher-event', }); /** user-defined constants */ /** user-defined types */ export interface IngressPayload { id: string; message: string; ingress_type: IngressType; percent: number | null; total: number } export type IngressType = { Download: { file_name: string } } | 'JavaPrepare' | 'JavaCheck' | 'JavaLocate' | 'MinecraftDownload' | { PrepareCluster: { cluster_name: string } }; export type LauncherEvent = { Ingress: IngressPayload } | { Message: MessagePayload } | { Process: ProcessPayload }; export type MessageLevel = 'Info' | 'Warn' | 'Error'; export interface MessagePayload { level: MessageLevel; message: string } /** * A structure of all needed Minecraft credentials for logging in and account management. */ export interface MinecraftCredentials { /** * The uuid of the credentials. */ id: string; /** * The username of the Minecraft account. */ username: string; /** * The access token as a String. */ access_token: string; /** * The refresh token as a string for [`MinecraftState#refresh`]. */ refresh_token: string; /** * The time that the access token expires as a [`DateTime`]. */ expires: string; } export interface Process { pid: number; started_at: string; cluster_id: bigint; post_hook: string | null; account_id: string } export type ProcessPayload = { Starting: { command: string } } | { Started: { process: Process } } | { Stopped: { pid: number; exit_code: number } } | { Output: { pid: number; output: string } }; export interface SerializableError { kind: 'CoreError' } interface __EventObj__ { listen: ( cb: TAURI_API_EVENT.EventCallback, ) => ReturnType>; once: ( cb: TAURI_API_EVENT.EventCallback, ) => ReturnType>; emit: null extends T ? (payload?: T) => ReturnType : (payload: T) => ReturnType; } export type Result = | { status: 'ok'; data: T } | { status: 'error'; error: E }; function __makeEvents__>( mappings: Record, ) { return new Proxy( {} as unknown as { [K in keyof T]: __EventObj__ & { (handle: __WebviewWindow__): __EventObj__; }; }, { get: (_, event) => { const name = mappings[event as keyof T]; return new Proxy((() => {}) as any, { apply: (_, __, [window]: [__WebviewWindow__]) => ({ listen: (arg: any) => window.listen(name, arg), once: (arg: any) => window.once(name, arg), emit: (arg: any) => window.emit(name, arg), }), get: (_, command: keyof __EventObj__) => { switch (command) { case 'listen': return (arg: any) => TAURI_API_EVENT.listen(name, arg); case 'once': return (arg: any) => TAURI_API_EVENT.once(name, arg); case 'emit': return (arg: any) => TAURI_API_EVENT.emit(name, arg); } }, }); }, }, ); }