From 8c332fe75c34ecbbf9a28a731c568dc1022cfed4 Mon Sep 17 00:00:00 2001 From: cswimr Date: Sun, 9 Feb 2025 16:37:21 -0600 Subject: [PATCH] document interfaces --- src/parser.ts | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/parser.ts b/src/parser.ts index c8be886..8fcea83 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -14,12 +14,39 @@ import * as semver from "semver"; * The structure of a Packwiz metafile. */ export interface Metafile { + /** + * A human-readable name for the file. + */ name: string; + /** + * The name that the file should have when downloaded. + */ filename: string; + /** + * Whether the file is for the client or server. + * Consuming applications should respect this! + */ side: Side; + /** + * The provider to use to download / update the file. + * All consuming applications should be doing with this is downloading the file. + * Updates are handled by Packwiz itself. + */ provider: UrlProvider; + /** + * Whether the file is optional. + * If true, the end user should be prompted to download the file. + */ isOptional: boolean; + /** + * Whether the file is the default for the mod. + * If this is true, but isOptional is also true, the end user should be asked if they want to download the file. + */ isDefault: boolean; + /** + * The description of the file. + * This should be shown to end users. + */ description?: string; } @@ -126,9 +153,21 @@ export class IndexFileEntry { * Represents the structure of a Packwiz index file, as well as providing its location. */ export interface PackwizIndex { + /** + * The location of the index file. This can be a local file path or a remote URL. + */ location: Resource; + /** + * The hash of the index file. + */ hash: string; + /** + * The hash format of the index file. + */ hashFormat: HashFormat; + /** + * The files listed in the index file. + */ files: IndexFileEntry[]; } @@ -137,11 +176,29 @@ export interface PackwizIndex { * If any of these are not undefined, applications using this information should install the specific version of the modlaoder listed. */ export interface PackwizVersions { + /** + * The Minecraft version that the pack is for. + */ minecraft: string; + /** + * The version of [Fabric](https://fabricmc.net/) that the pack targets. + */ fabric?: string; + /** + * The version of [Forge](https://files.minecraftforge.net/) that the pack targets. + */ forge?: string; + /** + * The version of [NeoForge](https://neoforged.net/) that the pack targets. + */ neoforge?: string; + /** + * The version of [Quilt](https://quiltmc.org/) that the pack targets. + */ quilt?: string; + /** + * The version of [LiteLoader](https://www.liteloader.com/) that the pack targets. + */ liteloader?: string; }