Skip to content

Latest commit

 

History

History
583 lines (350 loc) · 18 KB

_nexus_.nexus.md

File metadata and controls

583 lines (350 loc) · 18 KB

@nexusmods/nexus-apiGlobals"Nexus"Nexus

Class: Nexus

Main class of the api

Hierarchy

  • Nexus

Index

Constructors

Properties

Methods

Constructors

constructor

+ 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

Properties

events

events: TypedEmitter‹INexusEvents = new EventEmitter() as TypedEmitter<types.INexusEvents>

Defined in src/Nexus.ts:191

Methods

endorseMod

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

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

getColorschemes(): Promise‹IColourScheme[]›

Defined in src/Nexus.ts:428

get list of colorschemes

Returns: Promise‹IColourScheme[]›


getColourschemes

getColourschemes(): Promise‹IColourScheme[]›

Defined in src/Nexus.ts:420

get list of colourschemes

Returns: Promise‹IColourScheme[]›


getDownloadURLs

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

getEndorsements(): Promise‹IEndorsement[]›

Defined in src/Nexus.ts:412

get list of endorsements the user has given

Returns: Promise‹IEndorsement[]›


getFileByMD5

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

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

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

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

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

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

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

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

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

getRateLimits(): object

Defined in src/Nexus.ts:300

Returns: object

  • daily: number

  • hourly: number


getRecentlyUpdatedMods

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

getTrackedMods(): Promise‹ITrackedMod[]›

Defined in src/Nexus.ts:323

Get list of all mods being tracked by the user

Returns: Promise‹ITrackedMod[]›


getTrending

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

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

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

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

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

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

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

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


Static create

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


Static createWithOAuth

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