Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Service

Main API class to handle every call to the RSI-API as well as user-identification.

class

Service

Hierarchy

  • Service

Index

Constructors

constructor

Properties

Private cookieJar

cookieJar: any = popsicle.jar(new cookieStore(__dirname + "/../../../cache/cookie.json"))

cookieJar for api calls

Private input

input: ReadLine = rl.createInterface(process.stdin, process.stdout, null)

Private pwd

pwd: string

the password to use for login

Private rsi

rsi: string = "https://robertsspaceindustries.com/"

main rsi url

Private tokens

tokens: object

a collection of tokens

Type declaration

Private user

user: string

the username to use for login

Static Private _instance

_instance: Service = new Service()

Methods

PostAPIAutoComplete

  • PostAPIAutoComplete(subject: string, community_id?: number): Promise<RSIApiResponse>
  • Convenience method to push data to api/spectrum/search/member/autocomplete

    Parameters

    • subject: string

      the Monicker or Handle to search

    • Optional community_id: number

      the community_id in which to search

    Returns Promise<RSIApiResponse>

    the data returned by the RSI API

Private appendRSIToken

  • appendRSIToken(headers: Object): void

Private appendTavernToken

  • appendTavernToken(headers: any): void

Private askForCode

  • askForCode(): Promise<Object>

get

  • Sends a GET request to the Service Website. Will append the full Service url (with trailing slash)

    Parameters

    • url: any

      the endpoint

    Returns Promise<RSIApiResponse>

    a popsicle Promise

getBaseToken

  • getBaseToken(): Promise<boolean>

getRsiToken

  • getRsiToken(): string

Private getToken

  • getToken(tokenName?: string): void
  • Saves the current token from the cookieJar

    Parameters

    • Default value tokenName: string = "Rsi-Token"

      the name of the token to store

    Returns void

login

  • login(): Promise<any>
  • Performs a Login on the Service website. And sets auth token as needed.

    Returns Promise<any>

    wheter or not we're sucessfully logged-in.

Private multiStepAuth

  • multiStepAuth(): Promise<any>

Private pop

  • pop(opts: string): any
  • pop(opts: any): any

post

  • Sends a POST request to the Service Website. Will append the full Service url (with trailing slash)

    Parameters

    • url: any

      the endpoint

    • Optional data: any

      an object of data to send

    Returns Promise<RSIApiResponse>

    a popsicle Promise

setPassword

  • setPassword(password: string): void

setTavernId

  • setTavernId(tavernId: any): void

setUsername

  • setUsername(username: string): void

Static getInstance

Generated using TypeDoc