@nexusmods/nexus-api › Globals › "Nexus" › Nexus
Main class of the api
- Nexus
- endorseMod
- getChangelogs
- getColorschemes
- getColourschemes
- getDownloadURLs
- getEndorsements
- getFileByMD5
- getFileInfo
- getGameInfo
- getGames
- getLatestAdded
- getLatestUpdated
- getModFiles
- getModInfo
- getOwnIssues
- getRateLimits
- getRecentlyUpdatedMods
- getTrackedMods
- getTrending
- getValidationResult
- sendFeedback
- setGame
- setKey
- trackMod
- untrackMod
- validateKey
- create
- createWithOAuth
+ new Nexus(appName
: string, appVersion
: string, defaultGame
: string, timeout?
: number): Nexus
Defined in src/Nexus.ts:200
Constructor please don't use this directly, use Nexus.create
Parameters:
Name | Type | Description |
---|---|---|
appName |
string | Name of the client application |
appVersion |
string | Version number of the client application (Needs to be semantic format) |
defaultGame |
string | (nexus) id of the game requests are made for. Can be overridden per request |
timeout? |
number | Request timeout in milliseconds. Defaults to 30 seconds |
Returns: Nexus
• events: TypedEmitter‹INexusEvents› = new EventEmitter() as TypedEmitter<types.INexusEvents>
Defined in src/Nexus.ts:191
▸ endorseMod(modId
: number, modVersion
: string, endorseStatus
: "endorse" | "abstain", gameId?
: string): Promise‹IEndorseResponse›
Defined in src/Nexus.ts:471
Endorse/Unendorse a mod
Parameters:
Name | Type | Description |
---|---|---|
modId |
number | (nexus) id of the mod to endorse |
modVersion |
string | version of the mod the user has installed (has to correspond to a version that actually exists) |
endorseStatus |
"endorse" | "abstain" | the new endorsement state |
gameId? |
string | (nexus) id of the game to endorse |
Returns: Promise‹IEndorseResponse›
▸ getChangelogs(modId
: number, gameId?
: string): Promise‹IChangelogs›
Defined in src/Nexus.ts:500
retrieve all changelogs for a mod
Parameters:
Name | Type | Description |
---|---|---|
modId |
number | (nexus) id of the mod |
gameId? |
string | (nexus) game id |
Returns: Promise‹IChangelogs›
▸ getColorschemes(): Promise‹IColourScheme[]›
Defined in src/Nexus.ts:428
get list of colorschemes
Returns: Promise‹IColourScheme[]›
▸ getColourschemes(): Promise‹IColourScheme[]›
Defined in src/Nexus.ts:420
get list of colourschemes
Returns: Promise‹IColourScheme[]›
▸ getDownloadURLs(modId
: number, fileId
: number, key?
: string, expires?
: number, gameId?
: string): Promise‹IDownloadURL[]›
Defined in src/Nexus.ts:547
generate download links for a file If the user isn't premium on Nexus Mods, this requires a key that can only be generated on the website. The key is part of the nxm links that are generated by the "Download with Manager" buttons.
Parameters:
Name | Type | Description |
---|---|---|
modId |
number | id of the mod |
fileId |
number | id of the file |
key? |
string | a download key |
expires? |
number | expiry time of the key |
gameId? |
string | id of the game |
Returns: Promise‹IDownloadURL[]›
▸ getEndorsements(): Promise‹IEndorsement[]›
Defined in src/Nexus.ts:412
get list of endorsements the user has given
Returns: Promise‹IEndorsement[]›
▸ getFileByMD5(hash
: string, gameId?
: string): Promise‹IMD5Result[]›
Defined in src/Nexus.ts:572
find information about a file based on its md5 hash This can be used to find info about a file when you don't have its modid and fileid Note that technically there may be multiple results for the same md5 hash, either the same file uploaded in different places or (less likely) different files that just happen to have the same hash. This function will return all of them, you will have to sort out from the result which file you were actually looking for (e.g. by comparing size)
Parameters:
Name | Type | Description |
---|---|---|
hash |
string | the md5 hash of the file |
gameId? |
string | the game to search in |
Returns: Promise‹IMD5Result[]›
▸ getFileInfo(modId
: number, fileId
: number, gameId?
: string): Promise‹IFileInfo›
Defined in src/Nexus.ts:528
get details about a file
Parameters:
Name | Type | Description |
---|---|---|
modId |
number | (nexus) id of the mod |
fileId |
number | (nexus) id of the file |
gameId? |
string | (nexus) id of the game |
Returns: Promise‹IFileInfo›
▸ getGameInfo(gameId?
: string): Promise‹IGameInfo›
Defined in src/Nexus.ts:440
retrieve details about a specific game
Parameters:
Name | Type | Description |
---|---|---|
gameId? |
string | (nexus) game id to request |
Returns: Promise‹IGameInfo›
▸ getGames(): Promise‹IGameListEntry[]›
Defined in src/Nexus.ts:371
retrieve a list of all games currently supported by Nexus Mods
Returns: Promise‹IGameListEntry[]›
list of games
▸ getLatestAdded(gameId?
: string): Promise‹IModInfo[]›
Defined in src/Nexus.ts:380
get list of the latest added mods
Parameters:
Name | Type | Description |
---|---|---|
gameId? |
string | id of the game to query |
Returns: Promise‹IModInfo[]›
▸ getLatestUpdated(gameId?
: string): Promise‹IModInfo[]›
Defined in src/Nexus.ts:391
get list of the latest updated mods
Parameters:
Name | Type | Description |
---|---|---|
gameId? |
string | id of the game to query |
Returns: Promise‹IModInfo[]›
▸ getModFiles(modId
: number, gameId?
: string): Promise‹IModFiles›
Defined in src/Nexus.ts:512
get list of all files uploaded for a mod
Parameters:
Name | Type | Description |
---|---|---|
modId |
number | (nexus) id of the mod |
gameId? |
string | (nexus) game id |
Returns: Promise‹IModFiles›
▸ getModInfo(modId
: number, gameId?
: string): Promise‹IModInfo›
Defined in src/Nexus.ts:488
retrieve details about a mod
Parameters:
Name | Type | Description |
---|---|---|
modId |
number | (nexus) id of the mod |
gameId? |
string | (nexus) game id |
Returns: Promise‹IModInfo›
▸ getOwnIssues(): Promise‹IIssue[]›
Defined in src/Nexus.ts:598
get list of issues reported by this user FOR INTERNAL USE ONLY
Returns: Promise‹IIssue[]›
▸ getRateLimits(): object
Defined in src/Nexus.ts:300
Returns: object
-
daily: number
-
hourly: number
▸ getRecentlyUpdatedMods(period
: types.UpdatePeriod, gameId?
: string): Promise‹IUpdateEntry[]›
Defined in src/Nexus.ts:453
retrieve list of mods for a game that has recently been updated
Parameters:
Name | Type | Description |
---|---|---|
period |
types.UpdatePeriod | rough time range to retrieve. This is limited to specific periods (1d, 1w, 1m) because the list is cached on the server |
gameId? |
string | (nexus) game id to request |
Returns: Promise‹IUpdateEntry[]›
▸ getTrackedMods(): Promise‹ITrackedMod[]›
Defined in src/Nexus.ts:323
Get list of all mods being tracked by the user
Returns: Promise‹ITrackedMod[]›
▸ getTrending(gameId?
: string): Promise‹IModInfo[]›
Defined in src/Nexus.ts:402
get list of trending mods
Parameters:
Name | Type | Description |
---|---|---|
gameId? |
string | id of the game to query |
Returns: Promise‹IModInfo[]›
▸ getValidationResult(): IValidateKeyResponse
Defined in src/Nexus.ts:274
retrieve the result of the last key validation. This is useful primarily after creating the object with Nexus.create
Returns: IValidateKeyResponse
▸ sendFeedback(title
: string, message
: string, fileBundle
: string, anonymous
: boolean, groupingKey?
: string, id?
: string): Promise‹IFeedbackResponse›
Defined in src/Nexus.ts:615
send a feedback message FOR INTERNAL USE ONLY
Parameters:
Name | Type | Description |
---|---|---|
title |
string | title of the message |
message |
string | content |
fileBundle |
string | path to an archive that is sent along |
anonymous |
boolean | whether the report should be made anonymously |
groupingKey? |
string | a key that is used to group identical reports |
id? |
string | reference id |
Returns: Promise‹IFeedbackResponse›
▸ setGame(gameId
: string): void
Defined in src/Nexus.ts:266
change the default game id
Parameters:
Name | Type | Description |
---|---|---|
gameId |
string | game id |
Returns: void
▸ setKey(apiKey
: string): Promise‹IValidateKeyResponse›
Defined in src/Nexus.ts:283
change the API Key and validate it This can also be used to unset the key
Parameters:
Name | Type | Description |
---|---|---|
apiKey |
string | the new api key to set |
Returns: Promise‹IValidateKeyResponse›
A promise that resolves to the user info on success or null if the apikey was undefined
▸ trackMod(modId
: string, gameId?
: string): Promise‹ITrackResponse›
Defined in src/Nexus.ts:334
start tracking a mod
Parameters:
Name | Type | Description |
---|---|---|
modId |
string | id of the mod |
gameId? |
string | id of the game |
Returns: Promise‹ITrackResponse›
▸ untrackMod(modId
: string, gameId?
: string): Promise‹ITrackResponse›
Defined in src/Nexus.ts:353
stop tracking a mod
Parameters:
Name | Type | Description |
---|---|---|
modId |
string | id of the mod |
gameId? |
string | id of the game |
Returns: Promise‹ITrackResponse›
▸ validateKey(key?
: string): Promise‹IValidateKeyResponse›
Defined in src/Nexus.ts:314
validate a specific API key This does not update the request quota or the cached validation result so it's not useful for re-checking the key after a validation error.
Parameters:
Name | Type | Description |
---|---|---|
key? |
string | the API key to validate. Tests the current one if left undefined |
Returns: Promise‹IValidateKeyResponse›
▸ create(apiKey
: string, appName
: string, appVersion
: string, defaultGame
: string, timeout?
: number): Promise‹Nexus›
Defined in src/Nexus.ts:248
create a Nexus instance and immediately verify the API Key
Parameters:
Name | Type | Description |
---|---|---|
apiKey |
string | the api key to use for connections |
appName |
string | name of the client application |
appVersion |
string | Version number of the client application (Needs to be semantic format) |
defaultGame |
string | (nexus) id of the game requests are made for. Can be overridden per request |
timeout? |
number | Request timeout in milliseconds. Defaults to 5000ms |
Returns: Promise‹Nexus›
▸ createWithOAuth(credentials
: IOAuthCredentials, config
: IOAuthConfig, appName
: string, appVersion
: string, defaultGame
: string, timeout?
: number): Promise‹Nexus›
Defined in src/Nexus.ts:254
Parameters:
Name | Type |
---|---|
credentials |
IOAuthCredentials |
config |
IOAuthConfig |
appName |
string |
appVersion |
string |
defaultGame |
string |
timeout? |
number |
Returns: Promise‹Nexus›