UNPKG

modrinth

Version:

JavaScript library for accessing the Modrinth API

60 lines (59 loc) 2.18 kB
import { Modrinth } from "../index"; import { ModrinthObject } from "../object"; import { Mod } from "./Mod"; import { User } from "./User"; import { Loader } from "../structs/tags/Loader"; import { VersionSource } from "../structs/VersionSource"; import { GameVersion } from "../structs/tags/GameVersion"; export interface UploadFile { name: string; data: any; } export declare type VersionType = "release" | "beta" | "alpha"; export interface VersionCreationSource { mod_id: string; file_parts: string[]; version_number: string; version_title: string; version_body: string; dependencies: unknown[]; game_versions: string[]; release_channel: VersionType; loaders: Loader[]; featured: boolean; } export interface VersionCreation { mod_id: string; title?: string; number: string; body: string; dependencies?: unknown[]; game_versions: string[]; type: VersionType; loaders: Loader[]; featured?: boolean; } /** @internal */ export declare type VersionSourceOmit = ("date_published" | "version_type"); export interface Version extends Omit<VersionSource, VersionSourceOmit> { date_published: Date; type: VersionType; loaders: Loader[]; game_versions: GameVersion[]; } export declare class Version extends ModrinthObject<typeof Version, Version, VersionSource> { static get(modrinth: Modrinth, id: string): Promise<Version>; static getMultiple(modrinth: Modrinth, ids: string[]): Promise<Version[]>; static fetch(modrinth: Modrinth, id: string): Promise<VersionSource>; static fetchMultiple(modrinth: Modrinth, ids: string[]): Promise<VersionSource[]>; static getObjectLocation(id: string): string; static getResourceLocation(id: string): string; static getCacheKey(id: string): string; static toSource(object: Version): VersionSource; static fromSource(modrinth: Modrinth, source: VersionSource): Version; static create(modrinth: Modrinth, body: VersionCreation, files: UploadFile[]): Promise<Version>; mutate(source: VersionSource): Version; getResourceLocation(): string; getMod(): Promise<Mod>; getAuthor(): Promise<User>; }