Class Poisun

Client class which proxies requests via an AxiosInstance

Hierarchy

  • Poisun

Constructors

  • Parameters

    • token: string

      [TheTokenFromRegisteringAnAgent]

    Returns Poisun

Properties

_client: AxiosInstance

The underlying AxiosInstance that makes the requests. This isn't ever directly called by the users.

_rateLimitedClient: RateLimitedAxiosInstance

Wrapper for the underlying axios instance which handles rate-limiting. (2 requests per 1 second)

_token: string

The token to use when making requests to protected routes

This is the token you get after registering an agent via the RegisterAgent funciton

agents: {
    me: (() => Promise<BaseResponse<Agent>>);
} = ...

Object which holds the endpoints pertaining to agents

Type declaration

  • me: (() => Promise<BaseResponse<Agent>>)
      • (): Promise<BaseResponse<Agent>>
      • Fetches the currently validated user's Agent information

        Returns Promise<BaseResponse<Agent>>

contract: {
    accept: ((contractId) => Promise<BaseResponse<ContractAcceptResponseBody>>);
    deliver: ((contractId, req) => Promise<BaseResponse<ContractDeliverResponseBody>>);
    fetch: ((contractId) => Promise<PaginatedResponse<Contract>>);
    fulfill: ((contractId) => Promise<BaseResponse<ContractAcceptResponseBody>>);
} = ...

Endpoints pertaining to contracts

Type declaration

  • accept: ((contractId) => Promise<BaseResponse<ContractAcceptResponseBody>>)
      • (contractId): Promise<BaseResponse<ContractAcceptResponseBody>>
      • Accepts a Contract given by its contract ID

        Parameters

        • contractId: string

          The ID of the contract to accept

        Returns Promise<BaseResponse<ContractAcceptResponseBody>>

  • deliver: ((contractId, req) => Promise<BaseResponse<ContractDeliverResponseBody>>)
      • (contractId, req): Promise<BaseResponse<ContractDeliverResponseBody>>
      • Delivers a Contractby its contract ID, as well as delivering the goods defined in the contract.

        Parameters

        • contractId: string

          The ID of the contract to deliver

        • req: ContractDeliverRequestBody

          Object containing information about the ship which contains the deliverable goods, the id of the good and the amount in units

          {
          shipSymbol: "string",
          tradeSymbol: "string",
          units: 123
          }

        Returns Promise<BaseResponse<ContractDeliverResponseBody>>

  • fetch: ((contractId) => Promise<PaginatedResponse<Contract>>)
      • (contractId): Promise<PaginatedResponse<Contract>>
      • Fetches a Contract by a given contract ID

        Parameters

        • contractId: string

          The ID of the contract to fetch

        Returns Promise<PaginatedResponse<Contract>>

  • fulfill: ((contractId) => Promise<BaseResponse<ContractAcceptResponseBody>>)
      • (contractId): Promise<BaseResponse<ContractAcceptResponseBody>>
      • Fulfills a Contract given by its contract ID

        Parameters

        • contractId: string

          The ID of the contract to fulfill

        Returns Promise<BaseResponse<ContractAcceptResponseBody>>

fleet: {
    ship: {
        cargo: ((shipSymbol) => Promise<BaseResponse<ShipCargo>>);
        cooldown: ((shipSymbol) => Promise<BaseResponse<Cooldown>>);
        createChart: ((shipSymbol) => Promise<BaseResponse<CreateChartResponseBody>>);
        createSurvey: ((shipSymbol) => Promise<BaseResponse<CreateSurveyResponseBody>>);
        dock: ((shipSymbol) => Promise<BaseResponse<ShipNav>>);
        extractResources: ((shipSymbol, req) => Promise<BaseResponse<ExtractResourcesResponseBody>>);
        fetch: ((shipSymbol) => Promise<BaseResponse<Ship>>);
        getNav: ((shipSymbol) => Promise<BaseResponse<ShipNav>>);
        jettisonCargo: ((shipSymbol, req) => Promise<BaseResponse<JettisonCargoResponseBody>>);
        jump: ((shipSymbol, req) => Promise<BaseResponse<JumpShipResponseBody>>);
        navigate: ((shipSymbol, req) => Promise<BaseResponse<ShipNavigateResponseBody>>);
        negotiateContract: ((shipSymbol) => Promise<BaseResponse<Contract>>);
        orbit: ((shipSymbol) => Promise<BaseResponse<ShipNav>>);
        patchNav: ((shipSymbol, req) => Promise<BaseResponse<ShipNav>>);
        purchase: ((req) => Promise<BaseResponse<PurchaseShipResponseBody>>);
        purchaseCargo: ((shipSymbol, req) => Promise<BaseResponse<PurchaseCargoResponseBody>>);
        refine: ((shipSymbol, req) => Promise<BaseResponse<ShipRefineResponseBody>>);
        refuel: ((shipSymbol) => Promise<BaseResponse<RefuelShipResponseBody>>);
        scanShips: ((shipSymbol) => Promise<BaseResponse<ScanShipsResponseBody>>);
        scanSystems: ((shipSymbol) => Promise<BaseResponse<ScanSystemsResponseBody>>);
        scanWaypoints: ((shipSymbol) => Promise<BaseResponse<ScanWaypointsResponseBody>>);
        sellCargo: ((shipSymbol, req) => Promise<BaseResponse<SellCargoResponseBody>>);
        transferCargo: ((shipSymbol, req) => Promise<BaseResponse<TransferCargoResponseBody>>);
        warp: ((shipSymbol, req) => Promise<BaseResponse<WarpShipResponseBody>>);
    };
    ships: ((limit, page) => Promise<PaginatedResponse<Ship>>);
} = ...

Endpoints pertaining to user's fleet

Type declaration

  • ship: {
        cargo: ((shipSymbol) => Promise<BaseResponse<ShipCargo>>);
        cooldown: ((shipSymbol) => Promise<BaseResponse<Cooldown>>);
        createChart: ((shipSymbol) => Promise<BaseResponse<CreateChartResponseBody>>);
        createSurvey: ((shipSymbol) => Promise<BaseResponse<CreateSurveyResponseBody>>);
        dock: ((shipSymbol) => Promise<BaseResponse<ShipNav>>);
        extractResources: ((shipSymbol, req) => Promise<BaseResponse<ExtractResourcesResponseBody>>);
        fetch: ((shipSymbol) => Promise<BaseResponse<Ship>>);
        getNav: ((shipSymbol) => Promise<BaseResponse<ShipNav>>);
        jettisonCargo: ((shipSymbol, req) => Promise<BaseResponse<JettisonCargoResponseBody>>);
        jump: ((shipSymbol, req) => Promise<BaseResponse<JumpShipResponseBody>>);
        navigate: ((shipSymbol, req) => Promise<BaseResponse<ShipNavigateResponseBody>>);
        negotiateContract: ((shipSymbol) => Promise<BaseResponse<Contract>>);
        orbit: ((shipSymbol) => Promise<BaseResponse<ShipNav>>);
        patchNav: ((shipSymbol, req) => Promise<BaseResponse<ShipNav>>);
        purchase: ((req) => Promise<BaseResponse<PurchaseShipResponseBody>>);
        purchaseCargo: ((shipSymbol, req) => Promise<BaseResponse<PurchaseCargoResponseBody>>);
        refine: ((shipSymbol, req) => Promise<BaseResponse<ShipRefineResponseBody>>);
        refuel: ((shipSymbol) => Promise<BaseResponse<RefuelShipResponseBody>>);
        scanShips: ((shipSymbol) => Promise<BaseResponse<ScanShipsResponseBody>>);
        scanSystems: ((shipSymbol) => Promise<BaseResponse<ScanSystemsResponseBody>>);
        scanWaypoints: ((shipSymbol) => Promise<BaseResponse<ScanWaypointsResponseBody>>);
        sellCargo: ((shipSymbol, req) => Promise<BaseResponse<SellCargoResponseBody>>);
        transferCargo: ((shipSymbol, req) => Promise<BaseResponse<TransferCargoResponseBody>>);
        warp: ((shipSymbol, req) => Promise<BaseResponse<WarpShipResponseBody>>);
    }

    Endpoints pertaining to User's ship

    • cargo: ((shipSymbol) => Promise<BaseResponse<ShipCargo>>)
        • (shipSymbol): Promise<BaseResponse<ShipCargo>>
        • Fetches a ship cargo by it's symbol

          Parameters

          • shipSymbol: string

            The symbol of the ship cargo to fetch

          Returns Promise<BaseResponse<ShipCargo>>

    • cooldown: ((shipSymbol) => Promise<BaseResponse<Cooldown>>)
        • (shipSymbol): Promise<BaseResponse<Cooldown>>
        • Gets a ship's cooldown information

          Parameters

          • shipSymbol: string

            The symbol of the ship to retreive cooldown information for

          Returns Promise<BaseResponse<Cooldown>>

    • createChart: ((shipSymbol) => Promise<BaseResponse<CreateChartResponseBody>>)
        • (shipSymbol): Promise<BaseResponse<CreateChartResponseBody>>
        • Creates a chart for a given ship

          Parameters

          • shipSymbol: string

            The symbol of the ship which will create the chart

          Returns Promise<BaseResponse<CreateChartResponseBody>>

    • createSurvey: ((shipSymbol) => Promise<BaseResponse<CreateSurveyResponseBody>>)
        • (shipSymbol): Promise<BaseResponse<CreateSurveyResponseBody>>
        • Sends a ship to start surveying

          Parameters

          • shipSymbol: string

            The symbol of the ship which will begin a survey

          Returns Promise<BaseResponse<CreateSurveyResponseBody>>

    • dock: ((shipSymbol) => Promise<BaseResponse<ShipNav>>)
        • (shipSymbol): Promise<BaseResponse<ShipNav>>
        • Sends a ship to the dock

          Parameters

          • shipSymbol: string

            The symbol of the ship to dock

          Returns Promise<BaseResponse<ShipNav>>

    • extractResources: ((shipSymbol, req) => Promise<BaseResponse<ExtractResourcesResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<ExtractResourcesResponseBody>>
        • Sends a ship to extract resources from a surveyed location

          Parameters

          • shipSymbol: string

            The symbol of the ship which will start extracting

          • req: ExtractResourceRequestBody

            Object containing survey information

            {
            survey: {Survey}
            }

          Returns Promise<BaseResponse<ExtractResourcesResponseBody>>

    • fetch: ((shipSymbol) => Promise<BaseResponse<Ship>>)
        • (shipSymbol): Promise<BaseResponse<Ship>>
        • Fetches a ship by it's symbol

          Parameters

          • shipSymbol: string

            The symbol of the ship to fetch

          Returns Promise<BaseResponse<Ship>>

    • getNav: ((shipSymbol) => Promise<BaseResponse<ShipNav>>)
        • (shipSymbol): Promise<BaseResponse<ShipNav>>
        • Gets a ship's navigation data

          Parameters

          • shipSymbol: string

            The symbol of the ship to fetch navigation data for

          Returns Promise<BaseResponse<ShipNav>>

    • jettisonCargo: ((shipSymbol, req) => Promise<BaseResponse<JettisonCargoResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<JettisonCargoResponseBody>>
        • Commands a ship to jettison a given cargo

          Parameters

          • shipSymbol: string

            The symbol of the ship to jettison cargo from

          • req: JettsionCargoRequestBody

            Object containing information which cargo to jettison and the amount

            {
            symbol: "string",
            units: 123
            }

          Returns Promise<BaseResponse<JettisonCargoResponseBody>>

    • jump: ((shipSymbol, req) => Promise<BaseResponse<JumpShipResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<JumpShipResponseBody>>
        • Commands a ship to perform a jump

          Parameters

          • shipSymbol: string

            The symbol of the ship to command a jump on

          • req: JumpShipRequestBody

            Object containing information about the system to jump to

            {
            systemSymbol: "string"
            }

          Returns Promise<BaseResponse<JumpShipResponseBody>>

    • navigate: ((shipSymbol, req) => Promise<BaseResponse<ShipNavigateResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<ShipNavigateResponseBody>>
        • Command a ship to navigate to a given waypoint

          Parameters

          • shipSymbol: string

            The symbol of the ship to navigate

          • req: ShipNavigateRequestBody

            Object containing information about the waypoint to navigate to

            {
            waypointSymbol: "string"
            }

          Returns Promise<BaseResponse<ShipNavigateResponseBody>>

    • negotiateContract: ((shipSymbol) => Promise<BaseResponse<Contract>>)
        • (shipSymbol): Promise<BaseResponse<Contract>>
        • Commands a ship to perform a contract negotiation

          Parameters

          • shipSymbol: string

            The symbol of the ship to perform a contract negotiation with

          Returns Promise<BaseResponse<Contract>>

    • orbit: ((shipSymbol) => Promise<BaseResponse<ShipNav>>)
        • (shipSymbol): Promise<BaseResponse<ShipNav>>
        • Commands a ship to go to orbit

          Parameters

          • shipSymbol: string

            The symbol of the ship to send to orbit

          Returns Promise<BaseResponse<ShipNav>>

    • patchNav: ((shipSymbol, req) => Promise<BaseResponse<ShipNav>>)
        • (shipSymbol, req): Promise<BaseResponse<ShipNav>>
        • Perform patching on a ship's navigation module

          Parameters

          • shipSymbol: string

            The symbol of the ship to perform the patch on

          • req: PatchShipNavRequestBody

            Object containing information about the flightmode

            {
            flightMode: "string"
            }

          Returns Promise<BaseResponse<ShipNav>>

    • purchase: ((req) => Promise<BaseResponse<PurchaseShipResponseBody>>)
        • (req): Promise<BaseResponse<PurchaseShipResponseBody>>
        • Confirms purchasing a new ship

          Parameters

          • req: PurchaseShipRequestBody

            Object containing information about which ship to purchase

            {
            shipType: "string",
            waypointSymbol: "string",
            }

          Returns Promise<BaseResponse<PurchaseShipResponseBody>>

    • purchaseCargo: ((shipSymbol, req) => Promise<BaseResponse<PurchaseCargoResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<PurchaseCargoResponseBody>>
        • Purchase cargo and store it on a given ship

          Parameters

          • shipSymbol: string

            The symbol of the ship that should store the cargo

          • req: PurchaseCargoRequestBody

            Object containing information about the cargo to buy

            {
            symbol: "string",
            units: 123
            }

          Returns Promise<BaseResponse<PurchaseCargoResponseBody>>

    • refine: ((shipSymbol, req) => Promise<BaseResponse<ShipRefineResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<ShipRefineResponseBody>>
        • Sends a produce to be refined

          Parameters

          • shipSymbol: string
          • req: ShipRefineRequestBody

            Object containing information about which produce to refine

            {
            produce: "string",
            }

          Returns Promise<BaseResponse<ShipRefineResponseBody>>

    • refuel: ((shipSymbol) => Promise<BaseResponse<RefuelShipResponseBody>>)
        • (shipSymbol): Promise<BaseResponse<RefuelShipResponseBody>>
        • Command a ship to start refueling

          Parameters

          • shipSymbol: string

            The symbol of the ship that should refuel

          Returns Promise<BaseResponse<RefuelShipResponseBody>>

    • scanShips: ((shipSymbol) => Promise<BaseResponse<ScanShipsResponseBody>>)
        • (shipSymbol): Promise<BaseResponse<ScanShipsResponseBody>>
        • Commands a ship to perform a scan of ships

          Parameters

          • shipSymbol: string

            The symbol of the ship to perform the scan

          Returns Promise<BaseResponse<ScanShipsResponseBody>>

    • scanSystems: ((shipSymbol) => Promise<BaseResponse<ScanSystemsResponseBody>>)
        • (shipSymbol): Promise<BaseResponse<ScanSystemsResponseBody>>
        • Commands a ship to perform a scan of systems

          Parameters

          • shipSymbol: string

            The symbol of the ship to perform the scan

          Returns Promise<BaseResponse<ScanSystemsResponseBody>>

    • scanWaypoints: ((shipSymbol) => Promise<BaseResponse<ScanWaypointsResponseBody>>)
        • (shipSymbol): Promise<BaseResponse<ScanWaypointsResponseBody>>
        • Commands a ship to perform a scan of waypoints

          Parameters

          • shipSymbol: string

            The symbol of the ship to perform the scan

          Returns Promise<BaseResponse<ScanWaypointsResponseBody>>

    • sellCargo: ((shipSymbol, req) => Promise<BaseResponse<SellCargoResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<SellCargoResponseBody>>
        • Sell a given cargo and amount from a given ship

          Parameters

          • shipSymbol: string

            The symbol of the ship to sell cargo from

          • req: SellCargoRequestBody

            Object containing information about the cargo to sell

            {
            symbol: "string",
            units: 123
            }

          Returns Promise<BaseResponse<SellCargoResponseBody>>

    • transferCargo: ((shipSymbol, req) => Promise<BaseResponse<TransferCargoResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<TransferCargoResponseBody>>
        • Transfers cargo between two ships

          Parameters

          • shipSymbol: string

            The symbol of the ship that cargo should be transferred from

          • req: TransferCargoRequestBody

            Object containing information about the ship receiving the cargo

            {
            tradeSymbol: "string",
            units: 123,
            shipSymbol: "string"
            }

          Returns Promise<BaseResponse<TransferCargoResponseBody>>

    • warp: ((shipSymbol, req) => Promise<BaseResponse<WarpShipResponseBody>>)
        • (shipSymbol, req): Promise<BaseResponse<WarpShipResponseBody>>
        • Warps a ship to a given waypoint

          Parameters

          • shipSymbol: string

            The symbol of the ship to perform a warp with

          • req: WarpShipRequestBody

            Object containing information about the warp

            {
            waypointSymbol: "string"
            }

          Returns Promise<BaseResponse<WarpShipResponseBody>>

  • ships: ((limit, page) => Promise<PaginatedResponse<Ship>>)
      • (limit, page): Promise<PaginatedResponse<Ship>>
      • Fetches multiple Ships, split by amount per page and page number

        Parameters

        • limit: number

          The limit of returned items per page, between 1 and 20 inclusive

        • page: number

          The page number to fetch, relative to given limits in the limit parameter

        Returns Promise<PaginatedResponse<Ship>>

Methods

  • Fetches multiple Contracts, split by amount per page and page number

    Parameters

    • limit: number

      The limit of returned items per page, between 1 and 20 inclusive

    • page: number

      The page number to fetch, relative to given limits in the limit parameter

    Returns Promise<PaginatedResponse<Contract>>

  • Fetches a Faction by a given FactionSymbol

    Parameters

    • symbol: string

      The Symbol of the faction to fetch

    Returns Promise<BaseResponse<Faction>>

  • Fetches multiple Factions, split by amount per page and page number

    Parameters

    • limit: number

      The limit of returned items per page, between 1 and 20 inclusive

    • page: number

      The page number to fetch, relative to given limits in the limit parameter

    Returns Promise<PaginatedResponse<Faction>>

  • Fetches a JumpGate from a given system and waypoint

    Parameters

    • systemSymbol: string

      The system to fetch the jumpgate from

    • waypointSymbol: string

      The waypoint to fetch from

    Returns Promise<BaseResponse<JumpGate>>

  • Fetches a Market from a given system and waypoint

    Parameters

    • systemSymbol: string

      The system to fetch the market from

    • waypointSymbol: string

      The waypoint to fetch from

    Returns Promise<BaseResponse<Market>>

  • Fetches a Shipyard from a given system and waypoint

    Parameters

    • systemSymbol: string

      The system to fetch the shipyard from

    • waypointSymbol: string

      The waypoint to fetch from

    Returns Promise<BaseResponse<Shipyard>>

  • Fetches a System given it's symbol

    Parameters

    • systemSymbol: string

      The symbol of the system to fetch

    Returns Promise<BaseResponse<System>>

  • Fetches multiple Systems, split by amount per page and page number

    Parameters

    • limit: number

      The limit of returned items per page, between 1 and 20 inclusive

    • page: number

      The page number to fetch, relative to given limits in the limit parameter

    Returns Promise<PaginatedResponse<System>>

  • Fetches a waypoint from a given system

    Parameters

    • systemSymbol: string

      The system to fetch the waypoint from

    • waypointSymbol: string

      The waypoint to fetch

    Returns Promise<BaseResponse<Waypoint>>

  • Fetches multiple Waypoints, split by amount per page and page number

    Parameters

    • systemSymbol: string

      The symbol of the system to fetch waypoints from

    • limit: number

      The limit of returned items per page, between 1 and 20 inclusive

    • page: number

      The page number to fetch, relative to given limits in the limit parameter

    Returns Promise<PaginatedResponse<Waypoint>>