|
| 1 | +// @ts-nocheck |
| 2 | +// This file has been generated by Specta. DO NOT EDIT. |
| 3 | + |
| 4 | +import { createTauRPCProxy as createProxy, type InferCommandOutput } from 'taurpc' |
| 5 | +type TAURI_CHANNEL<T> = (response: T) => void |
| 6 | + |
| 7 | + |
| 8 | +export type ClusterError = { type: "InvalidVersion"; data: string } | { type: "MissingJavaVersion"; data: string } | { type: "ClusterDownloading"; data: string } | { type: "ClusterAlreadyRunning"; data: string } |
| 9 | + |
| 10 | +export type ClusterModel = { id: bigint; folder_name: string; stage: ClusterStage; created_at: string; group_id: bigint | null; name: string; mc_version: string; mc_loader: GameLoader; mc_loader_version: string | null; last_played: string | null; overall_played: bigint | null; icon_url: Icon | null; setting_profile_name: string | null; linked_pack_id: string | null; linked_pack_version: string | null } |
| 11 | + |
| 12 | +export type ClusterStage = "notready" | "downloading" | "repairing" | "ready" |
| 13 | + |
| 14 | +export type ClusterUpdate = { name: string | null; icon_url: Icon | null } |
| 15 | + |
| 16 | +export type CreateCluster = { name: string; mc_version: string; mc_loader: GameLoader; mc_loader_version: string | null; icon: Icon | null } |
| 17 | + |
| 18 | +export type CryptoError = { type: "InvalidHash"; data: string } | { type: "InvalidAlgorithm"; data: string } |
| 19 | + |
| 20 | +export type DaoError = { type: "NotFound"; data: string } | { type: "AlreadyExists"; data: string } | { type: "InvalidValue"; data: string } |
| 21 | + |
| 22 | +export type DbVec = T[] |
| 23 | + |
| 24 | +export type DirectoryError = { type: "BaseDir"; data: string } |
| 25 | + |
| 26 | +export type DiscordError = { type: "MissingClientId"; data: string } | { type: "ConnectError"; data: string } |
| 27 | + |
| 28 | +export type Filters = { game_versions: string[] | null; loaders: GameLoader[] | null; categories: string[] | null; package_types: PackageType[] | null } |
| 29 | + |
| 30 | +export type GameLoader = "vanilla" | "forge" | "neoforge" | "quilt" | "fabric" | "legacyfabric" |
| 31 | + |
| 32 | +export type IOError = { type: "InvalidAbsolutePath"; data: string } | { type: "IOErrorWrapper"; data: string } | { type: "IOError"; data: string } | { type: "DeserializeError"; data: string } | { type: "AsyncZipError"; data: string } |
| 33 | + |
| 34 | +export type Icon = string |
| 35 | + |
| 36 | +export type IncompatiblePackageType = { type: "McVersion"; data: string } | { type: "Loader"; data: string } |
| 37 | + |
| 38 | +export type IngressError = { type: "NotFound"; data: string } |
| 39 | + |
| 40 | +export type IngressPayload = { id: string; message: string; ingress_type: IngressType; percent: number | null; total: number } |
| 41 | + |
| 42 | +export type IngressType = { Download: { file_name: string } } | "JavaPrepare" | "JavaCheck" | "JavaLocate" | "MinecraftDownload" | { PrepareCluster: { cluster_name: string } } |
| 43 | + |
| 44 | +export type JavaError = { type: "ParseVersion"; data: string } | { type: "Execute"; data: string } | { type: "MissingJava"; data: string } |
| 45 | + |
| 46 | +export type LauncherError = { type: "DirError"; data: DirectoryError } | { type: "IOError"; data: IOError } | { type: "IngressError"; data: IngressError } | { type: "JavaError"; data: JavaError } | { type: "CryptoError"; data: CryptoError } | { type: "DiscordError"; data: DiscordError } | { type: "MetadataError"; data: MetadataError } | { type: "ClusterError"; data: ClusterError } | { type: "MinecraftAuthError"; data: MinecraftAuthError } | { type: "ProcessError"; data: ProcessError } | { type: "PackageError"; data: PackageError } | { type: "DaoError"; data: DaoError } | { type: "SerdeError"; data: string } | { type: "AnyhowError"; data: string } | { type: "DbError"; data: string } | { type: "ReqwestError"; data: string } | { type: "InterpulseError"; data: string } | { type: "RegexError"; data: string } | { type: "SemaphoreError"; data: string } | { type: "UrlError"; data: string } | { type: "TauriError"; data: string } |
| 47 | + |
| 48 | +export type ManagedPackage = { id: string; slug: string; provider: Provider; package_type: PackageType; name: string; short_desc: string; body: string; version_ids: string[]; mc_versions: string[]; loaders: GameLoader[]; icon_url: string | null; created: string; updated: string; client: PackageSide; server: PackageSide; categories: string[]; license: PackageLicense | null; author: PackageAuthor; links: PackageLinks; status: PackageStatus; downloads: bigint; gallery: PackageGallery[] } |
| 49 | + |
| 50 | +export type ManagedUser = { id: string; username: string; url?: string | null; avatar_url?: string | null; bio?: string | null; is_organization_user?: boolean; role?: string | null } |
| 51 | + |
| 52 | +export type ManagedVersion = { version_id: string; project_id: string; display_name: string; display_version: string; changelog: string | null; dependencies: ManagedVersionDependency[]; mc_versions: string[]; release_type: PackageReleaseType; loaders: GameLoader[]; published: string; downloads: bigint; files: ManagedVersionFile[] } |
| 53 | + |
| 54 | +export type ManagedVersionDependency = { version_id: string | null; project_id: string | null; file_name: string | null; dependency_type: PackageDependencyType } |
| 55 | + |
| 56 | +export type ManagedVersionFile = { sha1: string; url: string; file_name: string; primary: boolean; size: bigint } |
| 57 | + |
| 58 | +export type MessageLevel = "Info" | "Warn" | "Error" |
| 59 | + |
| 60 | +export type MessagePayload = { level: MessageLevel; message: string } |
| 61 | + |
| 62 | +export type MetadataError = { type: "FetchError"; data: string } | { type: "NotModdedManifest"; data: string } | { type: "NotVanillaManifest"; data: string } | { type: "ParseError"; data: string } | { type: "NoMatchingLoader"; data: string } | { type: "NoMatchingVersion"; data: string } |
| 63 | + |
| 64 | +export type MinecraftAuthError = { type: "PublicKeyReading"; data: string } | { type: "PKCS8Error"; data: string } | { type: "SerializeError"; data: string } | { type: "DeserializeError"; data: string } | { type: "RequestError"; data: string } | { type: "SigningError"; data: string } | { type: "HashError"; data: string } | { type: "SessionIdError"; data: string } |
| 65 | + |
| 66 | +/** |
| 67 | + * A structure of all needed Minecraft credentials for logging in and account management. |
| 68 | + */ |
| 69 | +export type MinecraftCredentials = { |
| 70 | +/** |
| 71 | + * The uuid of the credentials. |
| 72 | + */ |
| 73 | +id: string; |
| 74 | +/** |
| 75 | + * The username of the Minecraft account. |
| 76 | + */ |
| 77 | +username: string; |
| 78 | +/** |
| 79 | + * The access token as a String. |
| 80 | + */ |
| 81 | +access_token: string; |
| 82 | +/** |
| 83 | + * The refresh token as a string for [`MinecraftState#refresh`]. |
| 84 | + */ |
| 85 | +refresh_token: string; |
| 86 | +/** |
| 87 | + * The time that the access token expires as a [`DateTime<Utc>`]. |
| 88 | + */ |
| 89 | +expires: string } |
| 90 | + |
| 91 | +export type PackageAuthor = { Team: { team_id: string; org_id: string | null } } | { Users: ManagedUser[] } |
| 92 | + |
| 93 | +export type PackageDependencyType = "required" | "optional" | "embedded" | "incompatible" |
| 94 | + |
| 95 | +/** |
| 96 | + * https://api.modrinth.com/v2/tag/donation_platform |
| 97 | + */ |
| 98 | +export type PackageDonationPlatform = "patreon" | "buymeacoffee" | "paypal" | "github" | "kofi" | "other" |
| 99 | + |
| 100 | +export type PackageDonationUrl = { id: PackageDonationPlatform; url: string } |
| 101 | + |
| 102 | +export type PackageError = { type: "NoPrimaryFile"; data: string } | { type: "IsModPack"; data: string } | { type: "Incompatible"; data: IncompatiblePackageType } |
| 103 | + |
| 104 | +export type PackageGallery = { url: string; thumbnail_url: string; title: string | null; description: string | null; featured: boolean | null } |
| 105 | + |
| 106 | +/** |
| 107 | + * https://spdx.org/licenses/ |
| 108 | + */ |
| 109 | +export type PackageLicense = { id: string; name: string; url: string | null } |
| 110 | + |
| 111 | +/** |
| 112 | + * https://docs.curseforge.com/rest-api/#tocS_ModLinks |
| 113 | + */ |
| 114 | +export type PackageLinks = { website: string | null; issues: string | null; source: string | null; wiki: string | null; donation: PackageDonationUrl[] | null; discord: string | null } |
| 115 | + |
| 116 | +export type PackageModel = { hash: string; file_name: string; version_id: string; published_at: string; display_name: string; display_version: string; package_type: PackageType; provider: Provider; package_id: string; mc_versions: DbVec<string>; mc_loader: DbVec<GameLoader>; icon: Icon | null } |
| 117 | + |
| 118 | +export type PackageReleaseType = "release" | "beta" | "alpha" |
| 119 | + |
| 120 | +export type PackageSide = "unknown" | "required" | "optional" | "unsupported" |
| 121 | + |
| 122 | +export type PackageStatus = "active" | "abandoned" |
| 123 | + |
| 124 | +export type PackageType = "mod" | "resourcepack" | "shader" | "datapack" | "modpack" |
| 125 | + |
| 126 | +export type Paginated<T> = { total: bigint; offset: bigint; limit: bigint; items: T[] } |
| 127 | + |
| 128 | +export type Process = { pid: number; started_at: string; cluster_id: bigint; post_hook: string | null; account_id: string } |
| 129 | + |
| 130 | +export type ProcessError = { type: "HookUnsuccessful"; data: string } | { type: "NoPid"; data: string } |
| 131 | + |
| 132 | +export type ProcessPayload = { type: "Starting"; command: string } | { type: "Started"; process: Process } | { type: "Stopped"; pid: number; exit_code: number } | { type: "Output"; pid: number; output: string } |
| 133 | + |
| 134 | +export type ProfileUpdate = { res: Resolution | null; force_fullscreen: boolean | null; mem_max: number | null; launch_args: string | null; launch_env: string | null; hook_pre: string | null; hook_wrapper: string | null; hook_post: string | null } |
| 135 | + |
| 136 | +export type Provider = "Modrinth" | "Curseforge" | "SkyClient" |
| 137 | + |
| 138 | +export type Resolution = { width: number; height: number } |
| 139 | + |
| 140 | +export type SearchQuery = { query: string | null; offset: bigint | null; limit: bigint | null; sort: Sort | null; filters: Filters | null } |
| 141 | + |
| 142 | +export type SearchResult = { project_id: string; project_type: string; slug: string; author: string; title: string; description: string; categories: string[]; display_categories: string[]; versions: string[]; downloads: bigint; icon_url: string; date_created: string; date_modified: string; latest_version: string; license: string; client_side: PackageSide; server_side: PackageSide; |
| 143 | +/** |
| 144 | + * List of URLs to images |
| 145 | + */ |
| 146 | +gallery: string[] } |
| 147 | + |
| 148 | +export type SettingProfileModel = { name: string; java_id: bigint | null; res: Resolution | null; force_fullscreen: boolean | null; mem_max: number | null; launch_args: string | null; launch_env: string | null; hook_pre: string | null; hook_wrapper: string | null; hook_post: string | null; os_extra: SettingsOsExtra | null } |
| 149 | + |
| 150 | +export type Settings = { global_game_settings: SettingProfileModel; allow_parallel_running_clusters: boolean; enable_gamemode: boolean; discord_enabled: boolean; max_concurrent_requests: bigint; settings_version: number; native_window_frame: boolean } |
| 151 | + |
| 152 | +export type SettingsOsExtra = Record<string, never> |
| 153 | + |
| 154 | +export type Sort = "Relevance" | "Downloads" | "Newest" | "Updated" |
| 155 | + |
| 156 | +/** |
| 157 | + * A game version of Minecraft |
| 158 | + */ |
| 159 | +export type Version = { |
| 160 | +/** |
| 161 | + * A unique identifier of the version |
| 162 | + */ |
| 163 | +id: string; |
| 164 | +/** |
| 165 | + * The release type of the version |
| 166 | + */ |
| 167 | +type: VersionType; |
| 168 | +/** |
| 169 | + * A link to additional information about the version |
| 170 | + */ |
| 171 | +url: string; |
| 172 | +/** |
| 173 | + * The latest time a file in this version was updated |
| 174 | + */ |
| 175 | +time: string; |
| 176 | +/** |
| 177 | + * The time this version was released |
| 178 | + */ |
| 179 | +releaseTime: string; |
| 180 | +/** |
| 181 | + * The SHA1 hash of the additional information about the version |
| 182 | + */ |
| 183 | +sha1: string; |
| 184 | +/** |
| 185 | + * Whether the version supports the latest player safety features |
| 186 | + */ |
| 187 | +complianceLevel: number; |
| 188 | +/** |
| 189 | + * The SHA1 hash of the original unmodified Minecraft version's JSON |
| 190 | + * This is only available when using the Pulseflow mirror |
| 191 | + */ |
| 192 | +originalSha1?: string | null } |
| 193 | + |
| 194 | +/** |
| 195 | + * The version type of Minecraft |
| 196 | + */ |
| 197 | +export type VersionType = |
| 198 | +/** |
| 199 | + * A major version, which is stable for all players to use |
| 200 | + */ |
| 201 | +"release" | |
| 202 | +/** |
| 203 | + * An experimental version, which is unstable and used for feature previews and beta testing |
| 204 | + */ |
| 205 | +"snapshot" | |
| 206 | +/** |
| 207 | + * The oldest versions before the game was released |
| 208 | + */ |
| 209 | +"old_alpha" | |
| 210 | +/** |
| 211 | + * Early versions of the game |
| 212 | + */ |
| 213 | +"old_beta" |
| 214 | + |
| 215 | +const ARGS_MAP = { 'onelauncher':'{"open_dev_tools":[],"return_error":[],"set_window_style":["decorations"]}', 'events':'{"process":["event"],"ingress":["event"],"message":["event"]}', 'core':'{"setDefaultUser":["uuid"],"launchCluster":["id","uuid"],"getUsers":[],"getPackageVersions":["provider","slug","mc_versions","loaders","offset","limit"],"downloadPackage":["provider","package_id","version_id","cluster_id","skip_compatibility"],"removeCluster":["id"],"removeUser":["uuid"],"getUsersFromAuthor":["provider","author"],"getPackageUser":["provider","slug"],"getClusters":[],"openMsaLogin":[],"getUser":["uuid"],"getProfileOrDefault":["name"],"getWorlds":["id"],"getGlobalProfile":[],"updateClusterProfile":["name","profile"],"getGameVersions":[],"getLoadersForVersion":["mc_version"],"readSettings":[],"searchPackages":["provider","query"],"createCluster":["options"],"writeSettings":["setting"],"getClusterById":["id"],"updateClusterById":["id","request"],"getScreenshots":["id"],"getPackage":["provider","slug"],"getMultiplePackages":["provider","slugs"],"getDefaultUser":["fallback"]}' } |
| 216 | +export type Router = { 'onelauncher': { return_error: () => Promise<null>, |
| 217 | +open_dev_tools: () => Promise<void>, |
| 218 | +set_window_style: (decorations: boolean) => Promise<void> }, |
| 219 | +'core': { getClusters: () => Promise<ClusterModel[]>, |
| 220 | +getClusterById: (id: bigint) => Promise<ClusterModel | null>, |
| 221 | +removeCluster: (id: bigint) => Promise<null>, |
| 222 | +createCluster: (options: CreateCluster) => Promise<ClusterModel>, |
| 223 | +launchCluster: (id: bigint, uuid: string | null) => Promise<null>, |
| 224 | +updateClusterById: (id: bigint, request: ClusterUpdate) => Promise<null>, |
| 225 | +getScreenshots: (id: bigint) => Promise<string[]>, |
| 226 | +getWorlds: (id: bigint) => Promise<string[]>, |
| 227 | +getProfileOrDefault: (name: string | null) => Promise<SettingProfileModel>, |
| 228 | +getGlobalProfile: () => Promise<SettingProfileModel>, |
| 229 | +updateClusterProfile: (name: string, profile: ProfileUpdate) => Promise<SettingProfileModel>, |
| 230 | +getGameVersions: () => Promise<Version[]>, |
| 231 | +getLoadersForVersion: (mcVersion: string) => Promise<GameLoader[]>, |
| 232 | +getUsers: () => Promise<MinecraftCredentials[]>, |
| 233 | +getUser: (uuid: string) => Promise<MinecraftCredentials | null>, |
| 234 | +removeUser: (uuid: string) => Promise<null>, |
| 235 | +getDefaultUser: (fallback: boolean | null) => Promise<MinecraftCredentials | null>, |
| 236 | +setDefaultUser: (uuid: string | null) => Promise<null>, |
| 237 | +openMsaLogin: () => Promise<MinecraftCredentials | null>, |
| 238 | +readSettings: () => Promise<Settings>, |
| 239 | +writeSettings: (setting: Settings) => Promise<null>, |
| 240 | +searchPackages: (provider: Provider, query: SearchQuery) => Promise<Paginated<SearchResult>>, |
| 241 | +getPackage: (provider: Provider, slug: string) => Promise<ManagedPackage>, |
| 242 | +getMultiplePackages: (provider: Provider, slugs: string[]) => Promise<ManagedPackage[]>, |
| 243 | +getPackageVersions: (provider: Provider, slug: string, mcVersions: string[] | null, loaders: GameLoader[] | null, offset: bigint, limit: bigint) => Promise<Paginated<ManagedVersion>>, |
| 244 | +getPackageUser: (provider: Provider, slug: string) => Promise<ManagedUser>, |
| 245 | +downloadPackage: (provider: Provider, packageId: string, versionId: string, clusterId: bigint, skipCompatibility: boolean | null) => Promise<PackageModel>, |
| 246 | +getUsersFromAuthor: (provider: Provider, author: PackageAuthor) => Promise<ManagedUser[]> }, |
| 247 | +'events': { ingress: (event: IngressPayload) => Promise<void>, |
| 248 | +message: (event: MessagePayload) => Promise<void>, |
| 249 | +process: (event: ProcessPayload) => Promise<void> } }; |
| 250 | + |
| 251 | + |
| 252 | +export type { InferCommandOutput } |
| 253 | +export const createTauRPCProxy = () => createProxy<Router>(ARGS_MAP) |
0 commit comments