curseforge-js 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -0
- package/dist/client/categories.d.ts +13 -0
- package/dist/client/categories.d.ts.map +1 -0
- package/dist/client/categories.js +18 -0
- package/dist/client/categories.js.map +1 -0
- package/dist/client/core.d.ts +16 -0
- package/dist/client/core.d.ts.map +1 -0
- package/dist/client/core.js +62 -0
- package/dist/client/core.js.map +1 -0
- package/dist/client/curseforge.d.ts +27 -0
- package/dist/client/curseforge.d.ts.map +1 -0
- package/dist/client/curseforge.js +35 -0
- package/dist/client/curseforge.js.map +1 -0
- package/dist/client/files.d.ts +19 -0
- package/dist/client/files.d.ts.map +1 -0
- package/dist/client/files.js +32 -0
- package/dist/client/files.js.map +1 -0
- package/dist/client/fingerprints.d.ts +12 -0
- package/dist/client/fingerprints.d.ts.map +1 -0
- package/dist/client/fingerprints.js +24 -0
- package/dist/client/fingerprints.js.map +1 -0
- package/dist/client/games.d.ts +19 -0
- package/dist/client/games.d.ts.map +1 -0
- package/dist/client/games.js +32 -0
- package/dist/client/games.js.map +1 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +9 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/minecraft.d.ts +16 -0
- package/dist/client/minecraft.d.ts.map +1 -0
- package/dist/client/minecraft.js +28 -0
- package/dist/client/minecraft.js.map +1 -0
- package/dist/client/mods.d.ts +19 -0
- package/dist/client/mods.d.ts.map +1 -0
- package/dist/client/mods.js +45 -0
- package/dist/client/mods.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +14 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/types/base.d.ts +49 -0
- package/dist/types/base.d.ts.map +1 -0
- package/dist/types/base.js +2 -0
- package/dist/types/base.js.map +1 -0
- package/dist/types/categories.d.ts +35 -0
- package/dist/types/categories.d.ts.map +1 -0
- package/dist/types/categories.js +2 -0
- package/dist/types/categories.js.map +1 -0
- package/dist/types/files.d.ts +146 -0
- package/dist/types/files.d.ts.map +1 -0
- package/dist/types/files.js +51 -0
- package/dist/types/files.js.map +1 -0
- package/dist/types/fingerprints.d.ts +44 -0
- package/dist/types/fingerprints.d.ts.map +1 -0
- package/dist/types/fingerprints.js +2 -0
- package/dist/types/fingerprints.js.map +1 -0
- package/dist/types/games.d.ts +70 -0
- package/dist/types/games.d.ts.map +1 -0
- package/dist/types/games.js +30 -0
- package/dist/types/games.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/minecraft.d.ts +84 -0
- package/dist/types/minecraft.d.ts.map +1 -0
- package/dist/types/minecraft.js +22 -0
- package/dist/types/minecraft.js.map +1 -0
- package/dist/types/mods.d.ts +171 -0
- package/dist/types/mods.d.ts.map +1 -0
- package/dist/types/mods.js +31 -0
- package/dist/types/mods.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/request.d.ts +21 -0
- package/dist/utils/request.d.ts.map +1 -0
- package/dist/utils/request.js +96 -0
- package/dist/utils/request.js.map +1 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# curseforge-js
|
|
2
|
+
|
|
3
|
+
A framework-agnostic JavaScript client for the [CurseForge API](https://docs.curseforge.com).
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/curseforge-js)
|
|
6
|
+
[](https://www.npmjs.com/package/curseforge-js)
|
|
7
|
+
[](https://github.com/creeperkatze/curseforge-js/actions)
|
|
8
|
+
[](https://codecov.io/github/creeperkatze/curseforge-js)
|
|
9
|
+
[](https://github.com/creeperkatze/curseforge-js/issues)
|
|
10
|
+
[](https://github.com/creeperkatze/curseforge-js/pulls)
|
|
11
|
+
[](https://github.com/creeperkatze/curseforge-js/stargazers)
|
|
12
|
+
|
|
13
|
+
[📝 Changelog](https://github.com/creeperkatze/curseforge-js/releases)
|
|
14
|
+
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install curseforge-js
|
|
19
|
+
pnpm add curseforge-js
|
|
20
|
+
yarn add curseforge-js
|
|
21
|
+
bun add curseforge-js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 🚀 Usage
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import CurseForgeClient from 'curseforge-js';
|
|
28
|
+
|
|
29
|
+
const client = new CurseForgeClient({
|
|
30
|
+
apiKey: 'your-api-key',
|
|
31
|
+
userAgent: 'my-app/1.0',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const mod = await client.mods.get(238222);
|
|
35
|
+
const files = await client.files.list(238222);
|
|
36
|
+
|
|
37
|
+
console.log(mod);
|
|
38
|
+
console.log(files);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 📖 API
|
|
42
|
+
|
|
43
|
+
### `new CurseForgeClient(options)`
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const client = new CurseForgeClient({
|
|
47
|
+
baseUrl: 'https://api.curseforge.com',
|
|
48
|
+
apiKey: 'your-api-key',
|
|
49
|
+
timeoutMs: 10_000,
|
|
50
|
+
userAgent: 'my-app/1.0',
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Options
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
interface CurseForgeClientOptions {
|
|
58
|
+
baseUrl?: string; // default: "https://api.curseforge.com"
|
|
59
|
+
apiKey?: string;
|
|
60
|
+
timeoutMs?: number; // default: 10000
|
|
61
|
+
userAgent?: string;
|
|
62
|
+
fetch?: typeof globalThis.fetch;
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Selected Methods
|
|
67
|
+
|
|
68
|
+
Games:
|
|
69
|
+
- `client.games.list(options?)`
|
|
70
|
+
- `client.games.get(gameId)`
|
|
71
|
+
- `client.games.getVersions(gameId)`
|
|
72
|
+
- `client.games.getVersionsV2(gameId)`
|
|
73
|
+
- `client.games.getVersionTypes(gameId)`
|
|
74
|
+
|
|
75
|
+
Categories:
|
|
76
|
+
- `client.categories.list(options)`
|
|
77
|
+
|
|
78
|
+
Minecraft:
|
|
79
|
+
- `client.minecraft.getVersions(options?)`
|
|
80
|
+
- `client.minecraft.getVersion(gameVersionString)`
|
|
81
|
+
- `client.minecraft.getModLoaders(options?)`
|
|
82
|
+
- `client.minecraft.getModLoader(modLoaderName)`
|
|
83
|
+
|
|
84
|
+
Mods:
|
|
85
|
+
- `client.mods.search(options)`
|
|
86
|
+
- `client.mods.get(modId)`
|
|
87
|
+
- `client.mods.getMods(body)`
|
|
88
|
+
- `client.mods.getFeatured(body)`
|
|
89
|
+
- `client.mods.getDescription(modId, options?)`
|
|
90
|
+
|
|
91
|
+
Files:
|
|
92
|
+
- `client.files.get(modId, fileId)`
|
|
93
|
+
- `client.files.list(modId, options?)`
|
|
94
|
+
- `client.files.getFiles(body)`
|
|
95
|
+
- `client.files.getChangelog(modId, fileId)`
|
|
96
|
+
- `client.files.getDownloadUrl(modId, fileId)`
|
|
97
|
+
|
|
98
|
+
Fingerprints:
|
|
99
|
+
- `client.fingerprints.getMatches(fingerprints, gameId?)`
|
|
100
|
+
- `client.fingerprints.getFuzzyMatches(fingerprints, gameId?)`
|
|
101
|
+
|
|
102
|
+
## 🔐 Authentication
|
|
103
|
+
|
|
104
|
+
Get an API key from [console.curseforge.com](https://console.curseforge.com/), then pass it at client creation time. It is sent as the `x-api-key` header on every request.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const client = new CurseForgeClient({
|
|
108
|
+
apiKey: 'your-api-key',
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const mod = await client.mods.get(238222);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 🌐 Custom Fetch
|
|
115
|
+
|
|
116
|
+
You can inject your own `fetch` implementation.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import CurseForgeClient from 'curseforge-js';
|
|
120
|
+
import fetch from 'node-fetch';
|
|
121
|
+
|
|
122
|
+
const client = new CurseForgeClient({
|
|
123
|
+
apiKey: 'your-api-key',
|
|
124
|
+
fetch,
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## ⚠️ Error Handling
|
|
129
|
+
|
|
130
|
+
All request, timeout, and API errors are thrown as `CurseForgeError`.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import CurseForgeClient, { CurseForgeError } from 'curseforge-js';
|
|
134
|
+
|
|
135
|
+
const client = new CurseForgeClient({ apiKey: 'your-api-key' });
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
await client.mods.get(0);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (error instanceof CurseForgeError) {
|
|
141
|
+
console.error(error.status);
|
|
142
|
+
console.error(error.message);
|
|
143
|
+
console.error(error.body);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 👨💻 Development
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
pnpm build
|
|
152
|
+
|
|
153
|
+
pnpm test
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 🤝 Contributing
|
|
157
|
+
|
|
158
|
+
Contributions are always welcome!
|
|
159
|
+
|
|
160
|
+
Please ensure you run `pnpm lint:fix` before opening a pull request.
|
|
161
|
+
|
|
162
|
+
## 📜 License
|
|
163
|
+
|
|
164
|
+
AGPL-3.0
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CurseForgeClientCore } from './core.js';
|
|
2
|
+
import type { Category, GetCategoriesOptions } from '../types/index.js';
|
|
3
|
+
/** API namespace for mod categories. */
|
|
4
|
+
export declare class CategoriesApi {
|
|
5
|
+
private readonly core;
|
|
6
|
+
constructor(core: CurseForgeClientCore);
|
|
7
|
+
/**
|
|
8
|
+
* Returns all available classes and categories of the specified game.
|
|
9
|
+
* Add `classId` to only return categories under that class, or `classesOnly` to only return the game's classes.
|
|
10
|
+
*/
|
|
11
|
+
list(options: GetCategoriesOptions): Promise<Category[]>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../src/client/categories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGxE,wCAAwC;AACxC,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAEvD;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAM/D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** API namespace for mod categories. */
|
|
2
|
+
export class CategoriesApi {
|
|
3
|
+
core;
|
|
4
|
+
constructor(core) {
|
|
5
|
+
this.core = core;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Returns all available classes and categories of the specified game.
|
|
9
|
+
* Add `classId` to only return categories under that class, or `classesOnly` to only return the game's classes.
|
|
10
|
+
*/
|
|
11
|
+
async list(options) {
|
|
12
|
+
const response = await this.core.requestJson('v1/categories', {
|
|
13
|
+
query: options,
|
|
14
|
+
});
|
|
15
|
+
return response.data;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=categories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/client/categories.ts"],"names":[],"mappings":"AAIA,wCAAwC;AACxC,MAAM,OAAO,aAAa;IACK;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,OAA6B;QACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAiC,eAAe,EAAE;YAC5F,KAAK,EAAE,OAAO;SACf,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CurseForgeClientOptions } from '../types/base.js';
|
|
2
|
+
/** Options passed to individual request methods. */
|
|
3
|
+
export interface RequestOptions {
|
|
4
|
+
query?: object;
|
|
5
|
+
body?: BodyInit | object | object[] | null;
|
|
6
|
+
method?: string;
|
|
7
|
+
headers?: HeadersInit;
|
|
8
|
+
}
|
|
9
|
+
/** Low-level HTTP client used internally by all API namespace classes. */
|
|
10
|
+
export declare class CurseForgeClientCore {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(options?: CurseForgeClientOptions);
|
|
13
|
+
/** Sends a request and parses the response body as JSON. */
|
|
14
|
+
requestJson<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/client/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAKhE,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,0EAA0E;AAC1E,qBAAa,oBAAoB;;gBAOnB,OAAO,GAAE,uBAA4B;IAQjD,4DAA4D;IACtD,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;CAgD7E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CurseForgeError } from '../errors.js';
|
|
2
|
+
import { buildApiUrl, withJsonBody, parseErrorBody, extractErrorMessage } from '../utils/request.js';
|
|
3
|
+
const DEFAULT_BASE_URL = 'https://api.curseforge.com';
|
|
4
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
5
|
+
/** Low-level HTTP client used internally by all API namespace classes. */
|
|
6
|
+
export class CurseForgeClientCore {
|
|
7
|
+
#baseUrl;
|
|
8
|
+
#apiKey;
|
|
9
|
+
#timeoutMs;
|
|
10
|
+
#userAgent;
|
|
11
|
+
#fetch;
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this.#baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
|
|
14
|
+
this.#apiKey = options.apiKey;
|
|
15
|
+
this.#timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
16
|
+
this.#userAgent = options.userAgent;
|
|
17
|
+
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
18
|
+
}
|
|
19
|
+
/** Sends a request and parses the response body as JSON. */
|
|
20
|
+
async requestJson(path, options = {}) {
|
|
21
|
+
const response = await this.#send(path, options);
|
|
22
|
+
return response.json();
|
|
23
|
+
}
|
|
24
|
+
async #send(path, options) {
|
|
25
|
+
const { query, body, method = body != null ? 'POST' : 'GET', headers: extraHeaders } = options;
|
|
26
|
+
const url = buildApiUrl(this.#baseUrl, path, query);
|
|
27
|
+
const init = withJsonBody({ method, body, headers: new Headers(extraHeaders) });
|
|
28
|
+
const headers = init.headers;
|
|
29
|
+
headers.set('Accept', 'application/json');
|
|
30
|
+
if (this.#userAgent) {
|
|
31
|
+
headers.set('User-Agent', this.#userAgent);
|
|
32
|
+
}
|
|
33
|
+
if (this.#apiKey) {
|
|
34
|
+
headers.set('x-api-key', this.#apiKey);
|
|
35
|
+
}
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const timer = setTimeout(() => controller.abort(), this.#timeoutMs);
|
|
38
|
+
let response;
|
|
39
|
+
try {
|
|
40
|
+
response = await this.#fetch(url, { ...init, signal: controller.signal });
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
44
|
+
throw new CurseForgeError(`Request timed out after ${this.#timeoutMs}ms`);
|
|
45
|
+
}
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
}
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
const responseBody = await parseErrorBody(response);
|
|
53
|
+
throw new CurseForgeError(extractErrorMessage(responseBody, response.status), {
|
|
54
|
+
status: response.status,
|
|
55
|
+
response,
|
|
56
|
+
body: responseBody,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return response;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/client/core.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CategoriesApi } from './categories.js';
|
|
2
|
+
import { FilesApi } from './files.js';
|
|
3
|
+
import { FingerprintsApi } from './fingerprints.js';
|
|
4
|
+
import { GamesApi } from './games.js';
|
|
5
|
+
import { MinecraftApi } from './minecraft.js';
|
|
6
|
+
import { ModsApi } from './mods.js';
|
|
7
|
+
import type { CurseForgeClientOptions } from '../types/base.js';
|
|
8
|
+
/**
|
|
9
|
+
* Client for the CurseForge API.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import CurseForgeClient from 'curseforge-js';
|
|
13
|
+
* const client = new CurseForgeClient({ apiKey: 'your-api-key' });
|
|
14
|
+
* const mod = await client.mods.get(238222);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class CurseForgeClient {
|
|
18
|
+
#private;
|
|
19
|
+
readonly categories: CategoriesApi;
|
|
20
|
+
readonly files: FilesApi;
|
|
21
|
+
readonly fingerprints: FingerprintsApi;
|
|
22
|
+
readonly games: GamesApi;
|
|
23
|
+
readonly minecraft: MinecraftApi;
|
|
24
|
+
readonly mods: ModsApi;
|
|
25
|
+
constructor(options?: CurseForgeClientOptions);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=curseforge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curseforge.d.ts","sourceRoot":"","sources":["../../src/client/curseforge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE;;;;;;;;GAQG;AACH,qBAAa,gBAAgB;;IAG3B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,OAAO,GAAE,uBAA4B;CAUlD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CurseForgeClientCore } from './core.js';
|
|
2
|
+
import { CategoriesApi } from './categories.js';
|
|
3
|
+
import { FilesApi } from './files.js';
|
|
4
|
+
import { FingerprintsApi } from './fingerprints.js';
|
|
5
|
+
import { GamesApi } from './games.js';
|
|
6
|
+
import { MinecraftApi } from './minecraft.js';
|
|
7
|
+
import { ModsApi } from './mods.js';
|
|
8
|
+
/**
|
|
9
|
+
* Client for the CurseForge API.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import CurseForgeClient from 'curseforge-js';
|
|
13
|
+
* const client = new CurseForgeClient({ apiKey: 'your-api-key' });
|
|
14
|
+
* const mod = await client.mods.get(238222);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export class CurseForgeClient {
|
|
18
|
+
#core;
|
|
19
|
+
categories;
|
|
20
|
+
files;
|
|
21
|
+
fingerprints;
|
|
22
|
+
games;
|
|
23
|
+
minecraft;
|
|
24
|
+
mods;
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
this.#core = new CurseForgeClientCore(options);
|
|
27
|
+
this.categories = new CategoriesApi(this.#core);
|
|
28
|
+
this.files = new FilesApi(this.#core);
|
|
29
|
+
this.fingerprints = new FingerprintsApi(this.#core);
|
|
30
|
+
this.games = new GamesApi(this.#core);
|
|
31
|
+
this.minecraft = new MinecraftApi(this.#core);
|
|
32
|
+
this.mods = new ModsApi(this.#core);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=curseforge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"curseforge.js","sourceRoot":"","sources":["../../src/client/curseforge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;;;;GAQG;AACH,MAAM,OAAO,gBAAgB;IAClB,KAAK,CAAuB;IAE5B,UAAU,CAAgB;IAC1B,KAAK,CAAW;IAChB,YAAY,CAAkB;IAC9B,KAAK,CAAW;IAChB,SAAS,CAAe;IACxB,IAAI,CAAU;IAEvB,YAAY,UAAmC,EAAE;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE/C,IAAI,CAAC,UAAU,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CurseForgeClientCore } from './core.js';
|
|
2
|
+
import type { File, GetModFilesOptions, GetModFilesRequestBody } from '../types/index.js';
|
|
3
|
+
import type { CurseForgePaginatedResponse } from '../types/base.js';
|
|
4
|
+
/** API namespace for mod files. */
|
|
5
|
+
export declare class FilesApi {
|
|
6
|
+
private readonly core;
|
|
7
|
+
constructor(core: CurseForgeClientCore);
|
|
8
|
+
/** Returns a single file of the specified mod. */
|
|
9
|
+
get(modId: number, fileId: number): Promise<File>;
|
|
10
|
+
/** Returns all files of the specified mod. */
|
|
11
|
+
list(modId: number, options?: GetModFilesOptions): Promise<CurseForgePaginatedResponse<File>>;
|
|
12
|
+
/** Returns a list of files by id. */
|
|
13
|
+
getFiles(body: GetModFilesRequestBody): Promise<File[]>;
|
|
14
|
+
/** Returns the changelog of a file in HTML format. */
|
|
15
|
+
getChangelog(modId: number, fileId: number): Promise<string>;
|
|
16
|
+
/** Returns a download URL for a specific file. */
|
|
17
|
+
getDownloadUrl(modId: number, fileId: number): Promise<string>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/client/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,KAAK,EAAsB,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAExF,mCAAmC;AACnC,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAEvD,kDAAkD;IAC5C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvD,8CAA8C;IACxC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAInG,qCAAqC;IAC/B,QAAQ,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAK7D,sDAAsD;IAChD,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOlE,kDAAkD;IAC5C,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMrE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** API namespace for mod files. */
|
|
2
|
+
export class FilesApi {
|
|
3
|
+
core;
|
|
4
|
+
constructor(core) {
|
|
5
|
+
this.core = core;
|
|
6
|
+
}
|
|
7
|
+
/** Returns a single file of the specified mod. */
|
|
8
|
+
async get(modId, fileId) {
|
|
9
|
+
const response = await this.core.requestJson(`v1/mods/${modId}/files/${fileId}`);
|
|
10
|
+
return response.data;
|
|
11
|
+
}
|
|
12
|
+
/** Returns all files of the specified mod. */
|
|
13
|
+
async list(modId, options) {
|
|
14
|
+
return this.core.requestJson(`v1/mods/${modId}/files`, { query: options });
|
|
15
|
+
}
|
|
16
|
+
/** Returns a list of files by id. */
|
|
17
|
+
async getFiles(body) {
|
|
18
|
+
const response = await this.core.requestJson('v1/mods/files', { body });
|
|
19
|
+
return response.data;
|
|
20
|
+
}
|
|
21
|
+
/** Returns the changelog of a file in HTML format. */
|
|
22
|
+
async getChangelog(modId, fileId) {
|
|
23
|
+
const response = await this.core.requestJson(`v1/mods/${modId}/files/${fileId}/changelog`);
|
|
24
|
+
return response.data;
|
|
25
|
+
}
|
|
26
|
+
/** Returns a download URL for a specific file. */
|
|
27
|
+
async getDownloadUrl(modId, fileId) {
|
|
28
|
+
const response = await this.core.requestJson(`v1/mods/${modId}/files/${fileId}/download-url`);
|
|
29
|
+
return response.data;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/client/files.ts"],"names":[],"mappings":"AAIA,mCAAmC;AACnC,MAAM,OAAO,QAAQ;IACU;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D,kDAAkD;IAClD,KAAK,CAAC,GAAG,CAAC,KAAa,EAAE,MAAc;QACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAA2B,WAAW,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC;QAC3G,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,8CAA8C;IAC9C,KAAK,CAAC,IAAI,CAAC,KAAa,EAAE,OAA4B;QACpD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAoC,WAAW,KAAK,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAChH,CAAC;IAED,qCAAqC;IACrC,KAAK,CAAC,QAAQ,CAAC,IAA4B;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAA6B,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACpG,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,sDAAsD;IACtD,KAAK,CAAC,YAAY,CAAC,KAAa,EAAE,MAAc;QAC9C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,WAAW,KAAK,UAAU,MAAM,YAAY,CAC7C,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,kDAAkD;IAClD,KAAK,CAAC,cAAc,CAAC,KAAa,EAAE,MAAc;QAChD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,WAAW,KAAK,UAAU,MAAM,eAAe,CAChD,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CurseForgeClientCore } from './core.js';
|
|
2
|
+
import type { FingerprintFuzzyMatchResult, FingerprintsMatchesResult, FolderFingerprint } from '../types/index.js';
|
|
3
|
+
/** API namespace for matching mod files by their Murmur2 fingerprints. */
|
|
4
|
+
export declare class FingerprintsApi {
|
|
5
|
+
private readonly core;
|
|
6
|
+
constructor(core: CurseForgeClientCore);
|
|
7
|
+
/** Returns mod files that match the given list of fingerprints, optionally scoped to a single game. */
|
|
8
|
+
getMatches(fingerprints: number[], gameId?: number): Promise<FingerprintsMatchesResult>;
|
|
9
|
+
/** Returns mod files that fuzzy-match the given list of folder fingerprints, optionally scoped to a single game. */
|
|
10
|
+
getFuzzyMatches(fingerprints: FolderFingerprint[], gameId?: number): Promise<FingerprintFuzzyMatchResult>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=fingerprints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprints.d.ts","sourceRoot":"","sources":["../../src/client/fingerprints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAG3B,0EAA0E;AAC1E,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAEvD,uGAAuG;IACjG,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAQ7F,oHAAoH;IAC9G,eAAe,CAAC,YAAY,EAAE,iBAAiB,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAOhH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** API namespace for matching mod files by their Murmur2 fingerprints. */
|
|
2
|
+
export class FingerprintsApi {
|
|
3
|
+
core;
|
|
4
|
+
constructor(core) {
|
|
5
|
+
this.core = core;
|
|
6
|
+
}
|
|
7
|
+
/** Returns mod files that match the given list of fingerprints, optionally scoped to a single game. */
|
|
8
|
+
async getMatches(fingerprints, gameId) {
|
|
9
|
+
const path = gameId != null ? `v1/fingerprints/${gameId}` : 'v1/fingerprints';
|
|
10
|
+
const response = await this.core.requestJson(path, {
|
|
11
|
+
body: { fingerprints },
|
|
12
|
+
});
|
|
13
|
+
return response.data;
|
|
14
|
+
}
|
|
15
|
+
/** Returns mod files that fuzzy-match the given list of folder fingerprints, optionally scoped to a single game. */
|
|
16
|
+
async getFuzzyMatches(fingerprints, gameId) {
|
|
17
|
+
const path = gameId != null ? `v1/fingerprints/fuzzy/${gameId}` : 'v1/fingerprints/fuzzy';
|
|
18
|
+
const response = await this.core.requestJson(path, {
|
|
19
|
+
body: { gameId, fingerprints },
|
|
20
|
+
});
|
|
21
|
+
return response.data;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=fingerprints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprints.js","sourceRoot":"","sources":["../../src/client/fingerprints.ts"],"names":[],"mappings":"AAQA,0EAA0E;AAC1E,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D,uGAAuG;IACvG,KAAK,CAAC,UAAU,CAAC,YAAsB,EAAE,MAAe;QACtD,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAC9E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAgD,IAAI,EAAE;YAChG,IAAI,EAAE,EAAE,YAAY,EAAE;SACvB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,oHAAoH;IACpH,KAAK,CAAC,eAAe,CAAC,YAAiC,EAAE,MAAe;QACtE,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC;QAC1F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAkD,IAAI,EAAE;YAClG,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;SAC/B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CurseForgeClientCore } from './core.js';
|
|
2
|
+
import type { Game, GameVersionsByType, GameVersionsByType2, GameVersionType, GetGamesOptions } from '../types/index.js';
|
|
3
|
+
import type { CurseForgePaginatedResponse } from '../types/base.js';
|
|
4
|
+
/** API namespace for games. */
|
|
5
|
+
export declare class GamesApi {
|
|
6
|
+
private readonly core;
|
|
7
|
+
constructor(core: CurseForgeClientCore);
|
|
8
|
+
/** Returns all games available to the provided API key. */
|
|
9
|
+
list(options?: GetGamesOptions): Promise<CurseForgePaginatedResponse<Game>>;
|
|
10
|
+
/** Returns a single game. A private game is only accessible by its respective API key. */
|
|
11
|
+
get(gameId: number): Promise<Game>;
|
|
12
|
+
/** Returns all available versions for each known version type of the specified game. */
|
|
13
|
+
getVersions(gameId: number): Promise<GameVersionsByType[]>;
|
|
14
|
+
/** Returns all available version types of the specified game. */
|
|
15
|
+
getVersionTypes(gameId: number): Promise<GameVersionType[]>;
|
|
16
|
+
/** Returns all available versions for each known version type of the specified game, as full version objects. */
|
|
17
|
+
getVersionsV2(gameId: number): Promise<GameVersionsByType2[]>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=games.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"games.d.ts","sourceRoot":"","sources":["../../src/client/games.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EACV,IAAI,EACJ,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAsB,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAExF,+BAA+B;AAC/B,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAEvD,2DAA2D;IACrD,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAIjF,0FAA0F;IACpF,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxC,wFAAwF;IAClF,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAOhE,iEAAiE;IAC3D,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAOjE,iHAAiH;IAC3G,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAMpE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** API namespace for games. */
|
|
2
|
+
export class GamesApi {
|
|
3
|
+
core;
|
|
4
|
+
constructor(core) {
|
|
5
|
+
this.core = core;
|
|
6
|
+
}
|
|
7
|
+
/** Returns all games available to the provided API key. */
|
|
8
|
+
async list(options) {
|
|
9
|
+
return this.core.requestJson('v1/games', { query: options });
|
|
10
|
+
}
|
|
11
|
+
/** Returns a single game. A private game is only accessible by its respective API key. */
|
|
12
|
+
async get(gameId) {
|
|
13
|
+
const response = await this.core.requestJson(`v1/games/${gameId}`);
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
/** Returns all available versions for each known version type of the specified game. */
|
|
17
|
+
async getVersions(gameId) {
|
|
18
|
+
const response = await this.core.requestJson(`v1/games/${gameId}/versions`);
|
|
19
|
+
return response.data;
|
|
20
|
+
}
|
|
21
|
+
/** Returns all available version types of the specified game. */
|
|
22
|
+
async getVersionTypes(gameId) {
|
|
23
|
+
const response = await this.core.requestJson(`v1/games/${gameId}/version-types`);
|
|
24
|
+
return response.data;
|
|
25
|
+
}
|
|
26
|
+
/** Returns all available versions for each known version type of the specified game, as full version objects. */
|
|
27
|
+
async getVersionsV2(gameId) {
|
|
28
|
+
const response = await this.core.requestJson(`v2/games/${gameId}/versions`);
|
|
29
|
+
return response.data;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=games.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"games.js","sourceRoot":"","sources":["../../src/client/games.ts"],"names":[],"mappings":"AAUA,+BAA+B;AAC/B,MAAM,OAAO,QAAQ;IACU;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D,2DAA2D;IAC3D,KAAK,CAAC,IAAI,CAAC,OAAyB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAoC,UAAU,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;IAED,0FAA0F;IAC1F,KAAK,CAAC,GAAG,CAAC,MAAc;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAA2B,YAAY,MAAM,EAAE,CAAC,CAAC;QAC7F,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,wFAAwF;IACxF,KAAK,CAAC,WAAW,CAAC,MAAc;QAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,YAAY,MAAM,WAAW,CAC9B,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,iEAAiE;IACjE,KAAK,CAAC,eAAe,CAAC,MAAc;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,YAAY,MAAM,gBAAgB,CACnC,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,iHAAiH;IACjH,KAAK,CAAC,aAAa,CAAC,MAAc;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,YAAY,MAAM,WAAW,CAC9B,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { CurseForgeClientCore } from './core.js';
|
|
2
|
+
export { CategoriesApi } from './categories.js';
|
|
3
|
+
export { FilesApi } from './files.js';
|
|
4
|
+
export { FingerprintsApi } from './fingerprints.js';
|
|
5
|
+
export { GamesApi } from './games.js';
|
|
6
|
+
export { MinecraftApi } from './minecraft.js';
|
|
7
|
+
export { ModsApi } from './mods.js';
|
|
8
|
+
export { CurseForgeClient } from './curseforge.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { CurseForgeClientCore } from './core.js';
|
|
2
|
+
export { CategoriesApi } from './categories.js';
|
|
3
|
+
export { FilesApi } from './files.js';
|
|
4
|
+
export { FingerprintsApi } from './fingerprints.js';
|
|
5
|
+
export { GamesApi } from './games.js';
|
|
6
|
+
export { MinecraftApi } from './minecraft.js';
|
|
7
|
+
export { ModsApi } from './mods.js';
|
|
8
|
+
export { CurseForgeClient } from './curseforge.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CurseForgeClientCore } from './core.js';
|
|
2
|
+
import type { GetMinecraftModLoadersOptions, GetMinecraftVersionsOptions, MinecraftGameVersion, MinecraftModLoaderIndex, MinecraftModLoaderVersion } from '../types/index.js';
|
|
3
|
+
/** API namespace for Minecraft-specific game version and mod loader data. */
|
|
4
|
+
export declare class MinecraftApi {
|
|
5
|
+
private readonly core;
|
|
6
|
+
constructor(core: CurseForgeClientCore);
|
|
7
|
+
/** Returns all Minecraft game versions. */
|
|
8
|
+
getVersions(options?: GetMinecraftVersionsOptions): Promise<MinecraftGameVersion[]>;
|
|
9
|
+
/** Returns a specific Minecraft game version by its version string. */
|
|
10
|
+
getVersion(gameVersionString: string): Promise<MinecraftGameVersion>;
|
|
11
|
+
/** Returns Minecraft mod loaders, optionally filtered by game version. */
|
|
12
|
+
getModLoaders(options?: GetMinecraftModLoadersOptions): Promise<MinecraftModLoaderIndex[]>;
|
|
13
|
+
/** Returns a specific Minecraft mod loader by name. */
|
|
14
|
+
getModLoader(modLoaderName: string): Promise<MinecraftModLoaderVersion>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=minecraft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minecraft.d.ts","sourceRoot":"","sources":["../../src/client/minecraft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAG3B,6EAA6E;AAC7E,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAEvD,2CAA2C;IACrC,WAAW,CAAC,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAQzF,uEAAuE;IACjE,UAAU,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAO1E,0EAA0E;IACpE,aAAa,CAAC,OAAO,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAQhG,uDAAuD;IACjD,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAM9E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** API namespace for Minecraft-specific game version and mod loader data. */
|
|
2
|
+
export class MinecraftApi {
|
|
3
|
+
core;
|
|
4
|
+
constructor(core) {
|
|
5
|
+
this.core = core;
|
|
6
|
+
}
|
|
7
|
+
/** Returns all Minecraft game versions. */
|
|
8
|
+
async getVersions(options) {
|
|
9
|
+
const response = await this.core.requestJson('v1/minecraft/version', { query: options });
|
|
10
|
+
return response.data;
|
|
11
|
+
}
|
|
12
|
+
/** Returns a specific Minecraft game version by its version string. */
|
|
13
|
+
async getVersion(gameVersionString) {
|
|
14
|
+
const response = await this.core.requestJson(`v1/minecraft/version/${encodeURIComponent(gameVersionString)}`);
|
|
15
|
+
return response.data;
|
|
16
|
+
}
|
|
17
|
+
/** Returns Minecraft mod loaders, optionally filtered by game version. */
|
|
18
|
+
async getModLoaders(options) {
|
|
19
|
+
const response = await this.core.requestJson('v1/minecraft/modloader', { query: options });
|
|
20
|
+
return response.data;
|
|
21
|
+
}
|
|
22
|
+
/** Returns a specific Minecraft mod loader by name. */
|
|
23
|
+
async getModLoader(modLoaderName) {
|
|
24
|
+
const response = await this.core.requestJson(`v1/minecraft/modloader/${encodeURIComponent(modLoaderName)}`);
|
|
25
|
+
return response.data;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=minecraft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minecraft.js","sourceRoot":"","sources":["../../src/client/minecraft.ts"],"names":[],"mappings":"AAUA,6EAA6E;AAC7E,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D,2CAA2C;IAC3C,KAAK,CAAC,WAAW,CAAC,OAAqC;QACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,sBAAsB,EACtB,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,uEAAuE;IACvE,KAAK,CAAC,UAAU,CAAC,iBAAyB;QACxC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,wBAAwB,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,CAChE,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,aAAa,CAAC,OAAuC;QACzD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,wBAAwB,EACxB,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,uDAAuD;IACvD,KAAK,CAAC,YAAY,CAAC,aAAqB;QACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAC1C,0BAA0B,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAC9D,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|