text: const RestRoute = require("../restRoute.js");
  
  // /api/player
  // https://documenter.getpostman.com/view/5336131/SWT8hzsk?version=latest#eb02bd4a-e4ac-45c7-8465-82365e98d4e6
  class PlayerRoute extends RestRoute {
    constructor (config) {
      super(config);
    }
  
    // GET /api/player
    // https://documenter.getpostman.com/view/5336131/SWT8hzsk?version=latest#bde775bd-c3e3-453e-a4c2-1d27501933f0
    getPlayer (query, onSuccess, onError) {
      let parameters = {};
  
      let uuid = query.getString("uuid", null);
      if (uuid !== null) {
        parameters["uuid"] = uuid;
      }
  
      let username = query.getString("username", null);
      if (username !== null) {
        parameters["username"] = username;
      }
  
      let nickname = query.getString("nickname", null);
      if (username !== null) {
        parameters["nickname"] = nickname;
      }
  
      let location = query.getString("location", null);
      if (account !== null) {
        parameters["location"] = location;
      }
  
      let account = query.getString("account", null);
      if (account !== null) {
        parameters["account"] = account;
      }
  
      let admin = query.getString("admin", null);
      if (account !== null) {
        parameters["admin"] = admin;
      }
  
      let parameterString = "?";
      let parameterKeys = Object.keys(parameters);
      for (let i=0; i<parameterKeys.length; i++) {
        if (i !== parameterKeys.length-1) {
          parameterString += `${encodeURIComponent(parameterKeys[i])}=${encodeURIComponent(parameters[parameterKeys[i]])}&`
        }
        else {
          parameterString += `${encodeURIComponent(parameterKeys[i])}=${encodeURIComponent(parameters[parameterKeys[i]])}`
        }
      }
  
      this.request(`/player${parameterString}`, "GET", null, (resp)=>onSuccess, (err)=>onError);
    }
  
    // GET /api/player/:cid:
    // https://documenter.getpostman.com/view/5336131/SWT8hzsk?version=latest#0915971f-6979-4621-be76-c869c23dd36b
    getPlayerID (playerID, onSuccess, onError) {
      this.request(`/player/${encodeURIComponent(playerID)}`, (resp)=>onSuccess, (err)=>onError);
    }
  
    // GET /api/player/all
    // https://documenter.getpostman.com/view/5336131/SWT8hzsk?version=latest#2bb3022b-1b1d-4747-b0a3-e207555183c3
    getAllPlayers (onSuccess, onError) {
      this.request("/player/all", (resp)=>onSuccess, (err)=>onError);
    }
  
    // DEL /api/player/:cid:
    // https://documenter.getpostman.com/view/5336131/SWT8hzsk?version=latest#9b010035-9e34-45fb-b637-45caf300df2c
    kick (playerID, reason) {
      this.request(`/player/${playerID}?reason=${encodeURIComponent(reason)}`, "DELETE", null, (resp)=>{console.log(resp);}, (err)=>{console.log(err);});
    }
  
    // DEL /api/player/:cid:
    // https://documenter.getpostman.com/view/5336131/SWT8hzsk?version=latest#9b010035-9e34-45fb-b637-45caf300df2c
    tempBan (playerID, reason, timer) {
      this.request(`/player/${playerID}?reason=${encodeURIComponent(reason)}&duration=${encodeURIComponent(timer)}`, "DELETE", null, (resp)=>{console.log(resp);}, (err)=>{console.log(err);});
    }
  }
  
  module.exports = PlayerRoute;
  