mtxserv-node

Node.JS SDK providing easy access to mTxServ's API

Usage no npm install needed!

<script type="module">
  import mtxservNode from 'https://cdn.skypack.dev/mtxserv-node';
</script>

README

mtxserv-node

mtxserv-node

Node.JS SDK providing easy access to mTxServ's API

Javascript

InstallationUsageClasses & MethodsTestingNotesContributionBuilt WithMembersLicense

Installation

$ npm i mtxserv-node

Usage

// Initiate the client
const mTxServ = require('mtxserv-node')
const client = mTxServ.initialize({
  clientId: 'YOUR-CLIENT-ID',
  clientSecret: 'YOUR-CLIENT-SECRET',
  apiToken: 'YOUR-API-KEY'
})

// Use the client (Example)
let invoices = client.Invoice.getInvoicesList()

Classes & Methods

Architecture

Basically, methods are called like this:

something = client.Class.{subClass.}Method(params)

To-Do (Checked only when completly working)

  • Admin
  • Game
    • ARK
    • ARKWorkshop
    • Actions
    • Arma3
    • Backup
    • Bukkit
    • CSGO
    • Cod4
    • FTP
    • Files
    • GmodBackdoor
    • HTLV
    • History
    • Infos
    • Maps
    • MineBackup
    • MineBan
    • MineConfig
    • MineOperators
    • MineVersion
    • MineWhiteList
    • Minecraft
    • MineLive
    • Plugins
    • RestoreExpired
    • SRCDS
    • SRCDSPlugins
    • SRCDSWorkshop
    • STEAMStats
    • Tasks
    • eBOT
  • Hosting
    • Domain
  • Invoice
  • Password
  • Viewer
  • Voice
    • Actions
    • Mumble
    • Teamspeak

Testing

mtxserv-node-tests

Tests (using JEST) are avaiable in ./tests.

We are using dotenv to pass parameters to each test, please create a .env at root directory or modify the tests.

Run the tests:

$ npm test

Notes

Notations

gsId Corresponds to GameServer's ID

iId Corresponds to Invoice's ID

uId Corresponds to User's ID

(NB, Weird: Admin.getAdminList(iId) returns an Array of users. uId corresponds to user.id and not user.user_id provided by the API !)

Grants List

Global (Game / Voice / Hosting)

  • GRANTING_ACTIONS - Actions (Start, Stop, Restart) Ability
  • GRANTING_FTP - Files (WebFTP + FTP) Access
  • GRANTING_MYSQL - MySQL Access
  • GRANTING_DOMAIN - Domain Access
  • GRANTING_COLLABORATORS - Collaborators Management
  • GRANTING_BACKUP - Backups Management
  • GRANTING_TASKS - Periodic Tasks Management
  • GRANTING_REINSTALL - Reinstall Ability
  • GRANTING_RESTORE_EXPIRED - Restore Expired Server Ability
  • GRANTING_CONFIGURATION - Configuration Access
  • GRANTING_INVOICE - Invoice Access
  • GRANTING_PRIVILEGE_KEYS - Privileges Management
  • GRANTING_MUMBLE_CONSOLE - Mumble Console Access

Game

  • GAME_GRANTING_ACTIONS: Actions (Start, Stop, Restart, Force restart, Update) Ability
  • GAME_GRANTING_CONFIGURATION: Configuration Access
  • GAME_GRANTING_TASKS: Periodic Tasks Management
  • GAME_GRANTING_BACKUP: Backups Management
  • GAME_GRANTING_REINSTALL: Reinstall Ability
  • GAME_GRANTING_COLLABORATORS: Collaborators Management

Hosting

  • HOSTING_GRANTING_DOMAIN: Domain Access
  • HOSTING_GRANTING_FTP: Files (WebFTP + FTP) Access
  • HOSTING_GRANTING_MYSQL: MySQL Access
  • HOSTING_GRANTING_COLLABORATORS: Collaborators Management

Voice (Mumble / TeamSpeak)

  • TEAMSPEAK_GRANTING_ACTIONS: Actions (Start, Stop, Restart, Exec CVAR) Ability
  • TEAMSPEAK_GRANTING_CONFIGURATION: Configuration Access
  • TEAMSPEAK_GRANTING_PRIVILEGE_KEYS: Privileges Keys Management
  • TEAMSPEAK_GRANTING_REINSTALL: Reinstall Ability
  • TEAMSPEAK_GRANTING_COLLABORATORS: Collaborators Management
  • MUMBLE_GRANTING_ACTIONS: Actions (Start, Stop, Restart) Ability
  • MUMBLE_GRANTING_CONFIGURATION: Configuration Access
  • MUMBLE_GRANTING_MUMBLE_CONSOLE: Console Access
  • MUMBLE_GRANTING_REINSTALL: Reinstall Ability
  • MUMBLE_GRANTING_COLLABORATORS: Collaborators Management

Remarks

Invoice

  • POST /invoices/${iId}/offers/game - Documentation is wrong, don't know what it is for

Game

  • PUT /game/${gsId}/games - Couldn't test it because I don't have a server to test on
  • PUT /game/${gsId}/slots - Couldn't test it because I don't know what are the slots possibilities

Contribution

  • Fork the repository, use the development branch and please create pull requests to contribute to this project.
  • Follow the same coding style as used in the project. Pay attention to the usage of tabs, spaces, newlines and brackets. Try to copy the aesthetics as best as you can.
  • Write good commit messages, explain what your patch does, and why it is needed.
  • Keep it simple: Any patch that changes a lot of code or is difficult to understand should be discussed before you put in the effort.

Built With

  • dotenv^6.2.0 - Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env
  • jest^23.6.0 - Delightful JavaScript Testing
  • sync-request^6.0.0 - Make synchronous web requests with cross platform support.

Members

  • Yann SEGET - Main author - dev@leafgard.fr

https://github.com/Leafgard/mtxserv-node

License

This project is licensed under the MIT License - see the LICENSE.md file for details.