I am trying to order my functions in my Class like that:
- Client Class
- GAME1
- searchPlayer
- getStats
- GAME2
- getStats
- someotherfunction
So that when I use new Client({}).GAME1.searchPlayer()
I can access this function.
class Client {
constructor(options = {}) {
this.options = options;
if (!this.options.apiKey) return new Error('Missing API-Key');
}
GAME1 = {
searchPlayer (searchQuery='') {
return this.request(...);
}
};
GAME2 = {...}
request(uri) {
return new Promise((resolve, reject) => {
}
}
module.exports = Client;
But like that I can not access this.request