UNPKG

modrinth

Version:

JavaScript library for accessing the Modrinth API

32 lines (31 loc) 1.49 kB
import type { Modrinth } from "./index"; export interface ModrinthStaticModel<ObjectResult, ObjectSource> extends Function { get: (modrinth: Modrinth, id: string) => Promise<ObjectResult>; getMultiple: (modrinth: Modrinth, id: string[]) => Promise<ObjectResult[]>; fetch: (modrinth: Modrinth, id: string) => Promise<ObjectSource>; fetchMultiple: (modrinth: Modrinth, id: string[]) => Promise<ObjectSource[]>; getResourceLocation: (id: string) => string; getObjectLocation: (id: string) => string; getCacheKey: (id: string) => string; fromSource: (modrinth: Modrinth, source: ObjectSource) => ObjectResult; toSource: (object: ObjectResult) => Partial<ObjectSource>; } export declare class ModrinthObject<ModelStatic extends ModrinthStaticModel<ObjectResult, ObjectSource>, ObjectResult extends ModrinthObject<ModelStatic, ObjectResult, ObjectSource>, ObjectSource> { protected ["constructor"]: ModelStatic; protected _source: ObjectSource; protected _modrinth: Modrinth; protected _dirty: boolean; id: string; object_url: string; resource_url: string; constructor(modrinth: Modrinth, source: ObjectSource); protected mutate(source: ObjectSource): ObjectResult; protected fetch(): Promise<ObjectSource>; get(): Promise<ObjectResult>; getResourceLocation(): string; getResourceURL(): string; getObjectLocation(): string; getObjectURL(): string; toJSON(): unknown; toString(): string; }