|
1 |
| -import { IChangelogs, IGameInfo, IGameListEntry, IModFiles, IModInfo, IValidateKeyResponse } from '@nexusmods/nexus-api'; |
| 1 | +import { IChangelogs, IGameInfo, IGameListEntry, IModFiles, IModInfo, IUpdateEntry, IValidateKeyResponse } from '../../types/NexusModsAPIv1'; |
2 | 2 | import axios, { AxiosError } from 'axios';
|
3 | 3 | import { NexusAPIServerError, NexusSearchResult } from '../../types/util';
|
4 | 4 | import { Logger } from "../util";
|
5 | 5 |
|
6 | 6 | const nexusAPI: string = 'https://api.nexusmods.com/';
|
7 | 7 |
|
8 |
| -async function v1APIQuery (logger: Logger, path: string, headers: Record<string, string>, params?: { [key: string]: any }): Promise<any> { |
| 8 | +async function v1APIQuery <T>(logger: Logger, path: string, headers: Record<string, string>, params?: { [key: string]: any }): Promise<T> { |
9 | 9 | const authType = headers['apikey'] ? 'APIKEY' : 'OAUTH';
|
10 | 10 | try {
|
11 | 11 | const query = await axios({
|
@@ -55,7 +55,7 @@ export async function quicksearch(query: string, bIncludeAdult: boolean, game_id
|
55 | 55 | }
|
56 | 56 |
|
57 | 57 | export async function updatedMods(headers: Record<string,string>, logger: Logger, gameDomain: string, period: string = '1w', ) {
|
58 |
| - return v1APIQuery(logger, `/v1/games/${gameDomain}/mods/updated.json`, headers, { period }); |
| 58 | + return v1APIQuery<IUpdateEntry[]>(logger, `/v1/games/${gameDomain}/mods/updated.json`, headers, { period }); |
59 | 59 | }
|
60 | 60 |
|
61 | 61 | export async function modInfo(headers: Record<string,string>, logger: Logger, gameDomain: string, modId: number): Promise<IModInfo> {
|
|
0 commit comments