document the enums

This commit is contained in:
cswimr 2025-02-09 10:14:11 -06:00
parent 566bc90aab
commit 20403d09bd
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
6 changed files with 44 additions and 12 deletions

View file

@ -6,7 +6,9 @@
# Enumeration: HashFormat
Defined in: enums/hash-format.ts:1
Defined in: enums/hash-format.ts:4
The hash formats allowed by Packwiz.
## Enumeration Members
@ -14,7 +16,7 @@ Defined in: enums/hash-format.ts:1
> **md5**: `"md5"`
Defined in: enums/hash-format.ts:5
Defined in: enums/hash-format.ts:8
***
@ -22,7 +24,7 @@ Defined in: enums/hash-format.ts:5
> **murmur2**: `"murmur2"`
Defined in: enums/hash-format.ts:6
Defined in: enums/hash-format.ts:9
***
@ -30,7 +32,7 @@ Defined in: enums/hash-format.ts:6
> **sha1**: `"sha1"`
Defined in: enums/hash-format.ts:4
Defined in: enums/hash-format.ts:7
***
@ -38,7 +40,7 @@ Defined in: enums/hash-format.ts:4
> **sha256**: `"sha256"`
Defined in: enums/hash-format.ts:2
Defined in: enums/hash-format.ts:5
***
@ -46,4 +48,4 @@ Defined in: enums/hash-format.ts:2
> **sha512**: `"sha512"`
Defined in: enums/hash-format.ts:3
Defined in: enums/hash-format.ts:6

View file

@ -8,7 +8,9 @@
> **isValidHashFormat**(`hashFormat`): [`HashFormat`](../enumerations/HashFormat.md)
Defined in: enums/hash-format.ts:9
Defined in: enums/hash-format.ts:17
Checks if the provided hash format is allowed by Packwiz.
## Parameters
@ -16,6 +18,10 @@ Defined in: enums/hash-format.ts:9
`string`
The hash format to check.
## Returns
[`HashFormat`](../enumerations/HashFormat.md)
The HashFormat enum value if valid, otherwise throws an error.

View file

@ -6,7 +6,9 @@
# Enumeration: Side
Defined in: enums/side.ts:1
Defined in: enums/side.ts:4
The sides allowed by Packwiz.
## Enumeration Members
@ -14,7 +16,7 @@ Defined in: enums/side.ts:1
> **Both**: `"both"`
Defined in: enums/side.ts:2
Defined in: enums/side.ts:5
***
@ -22,7 +24,7 @@ Defined in: enums/side.ts:2
> **Client**: `"client"`
Defined in: enums/side.ts:3
Defined in: enums/side.ts:6
***
@ -30,4 +32,4 @@ Defined in: enums/side.ts:3
> **Server**: `"server"`
Defined in: enums/side.ts:4
Defined in: enums/side.ts:7

View file

@ -8,14 +8,20 @@
> **isValidSide**(`side`): [`Side`](../enumerations/Side.md)
Defined in: enums/side.ts:7
Defined in: enums/side.ts:15
Checks if the provided side is allowed by Packwiz.
## Parameters
### side
The side to check.
`undefined` | `string`
## Returns
[`Side`](../enumerations/Side.md)
The Side enum value if valid, otherwise throws an error.

View file

@ -1,3 +1,6 @@
/**
* The hash formats allowed by Packwiz.
*/
export enum HashFormat {
"sha256" = "sha256",
"sha512" = "sha512",
@ -6,6 +9,11 @@ export enum HashFormat {
"murmur2" = "murmur2",
}
/**
* Checks if the provided hash format is allowed by Packwiz.
* @param hashFormat - The hash format to check.
* @returns The HashFormat enum value if valid, otherwise throws an error.
*/
export function isValidHashFormat(hashFormat: string): HashFormat {
if (hashFormat in HashFormat) {
return HashFormat[hashFormat as keyof typeof HashFormat];

View file

@ -1,9 +1,17 @@
/**
* The sides allowed by Packwiz.
*/
export enum Side {
"Both" = "both",
"Client" = "client",
"Server" = "server",
}
/**
* Checks if the provided side is allowed by Packwiz.
* @param side - The side to check.
* @returns The Side enum value if valid, otherwise throws an error.
*/
export function isValidSide(side: string | undefined): Side {
if (side == undefined) {
return Side.Both;