Skip to content

dowmeister/trucky-services-client-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trucky App REST API client for node.js

Build Status

npm version

This package is the Trucky API client, complete gateway to TruckersMP, ETS2Map and Traffic data served from TruckersMP developers community (official and unofficial).

For API response documentation please refer to live documentation (http://api.truckyapp.com/docs/)

Installation

npm install trucky-services-client

Usage

var TruckyAPIClient = require('trucky-services-client');

var api = new TruckyAPIClient();
api.servers().then((response) => {
    console.log(response);
});

api.pois().then(function(response) {
    console.log(response);
});

api.resolveVanityUrl("dowmeister").then( (response) => {
    console.log(response);
});

Dependencies

  • node-fetch: A light-weight module that brings window.fetch to node.js and io.js

API

Table of Contents

TruckyAPIClient

Trucky API client class

resolveVanityUrl

Resolve Steam Vanity Url returning Steam player data if found

Parameters

  • username string Steam user vanity url

Returns Promise<TruckyAPIResponse>

getPlayerSummaries

Returns Steam Player data if found

Parameters

  • steamid string Steam User ID

Returns Promise<TruckyAPIResponse>

searchPlayer

Search player by Steam ID, Steam Username or TruckersMP ID based on searchType parameter

Parameters

  • searchTerm string Search Term, can be TruckersMP User ID, Steam User ID or Steam Vanity url
  • searchType string Can be "steamid", "truckersmpid", "steamusername"

Returns Promise<TruckyAPIResponse>

pois

Get ETS2Map Points of interest

Returns Promise<TruckyAPIResponse>

isOnline

Check TruckersMP player online status

Parameters

  • playerID number TruckersMP User ID

Returns Promise<TruckyAPIResponse>

isOnlineImproved

Check TruckersMP player online status - With improved informations, mapped map server and calculated location

Parameters

  • playerID number TruckersMP User ID

Returns Promise<TruckyAPIResponse>

getFriends

Get Steam Friends

Parameters

  • steamID string Steam User ID

Returns Promise<TruckyAPIResponse>

news

Get TruckersMP news feed from Steam RSS

Returns Promise<TruckyAPIResponse>

ets2News

Get ETS2 News feed from Steam RSS

Returns Promise<TruckyAPIResponse>

atsNews

Get ATS News feed from Steam RSS

Returns Promise<TruckyAPIResponse>

update_info

Get TruckersMP current update info and current plugin version

Returns Promise<TruckyAPIResponse>

events

Get events and meetup from ETS2.com and truckers.events

Returns Promise<TruckyAPIResponse>

servers

Get TruckersMP servers

Returns Promise<TruckyAPIResponse>

game_version

Get TruckersMP game version info

Returns Promise<TruckyAPIResponse>

game_time

Get TruckersMP game time

Returns Promise<TruckyAPIResponse>

rules

Get TruckersMP rules

Returns Promise<TruckyAPIResponse>

player

Get TruckersMP player data

Parameters

  • id number TruckersMP User ID

Returns Promise<TruckyAPIResponse>

bans

Get TruckersMP player bans data

Parameters

  • id number TruckersMP User ID

Returns Promise<TruckyAPIResponse>

traffic

Get TruckersMP traffic data from traffic.krashnz.com

Parameters

  • server string TruckersMP Server short name
  • game string Can be "ETS2" or "ATS"

Returns Promise<TruckyAPIResponse>

traffic_servers

Get TruckersMP get traffic servers data from traffic.krashnz.com

Returns Promise<TruckyAPIResponse>

wot_gallery_random

Get World Of Trucks Random Gallery

Returns Promise<TruckyAPIResponse>

wot_gallery_editorspick

Get World Of Trucks Editor's pick

Returns Promise<TruckyAPIResponse>

wot_gallery_bestrated

Get World Of Trucks Best rated

Returns Promise<TruckyAPIResponse>

wot_gallery_mostviewed

Get World Of Trucks most viewed

Returns Promise<TruckyAPIResponse>

streams_twitch_ets2

Get current Twitch streams for ETS2

Returns Promise<TruckyAPIResponse>

streams_twitch_ats

Get current Twitch streams for ATS

Returns Promise<TruckyAPIResponse>

truckersfm_listeners

Get TruckersFM current listeners

Returns Promise<TruckyAPIResponse>

truckersfm_shows

Get TruckersFM current show

Returns Promise<TruckyAPIResponse>

truckersfm_lastPlayed

Get TruckersFM last played song

Returns Promise<TruckyAPIResponse>

onlineList

Get players online state by TruckersMP ids array Search TruckersMP player by username

Parameters

  • ids

Returns Promise<TruckyAPIResponse>

searchPlayerByTruckersMPUsername

Search TruckersMP Player by username

Parameters

  • query

Returns Promise<TruckyAPIResponse>

getPlayerInfoComplete

Get TruckersMP player complete information with online state and Steam profile data

Parameters

  • query

Returns Promise<TruckyAPIResponse>

ets2_cities

Get list of ETS2 cities, with coordinates and country

Returns Promise<TruckyAPIResponse>

ats_cities

Get list of ATS cities, with coordinates and country

Returns Promise<TruckyAPIResponse>

map_servers

Get Map servers list, mapped on API servers

Returns Promise<TruckyAPIResponse>

TruckyAPIResponse

Trucky API client response prototype

Type: object

Properties