hqtrivia-api
Advanced tools
Comparing version 1.6.0 to 1.7.0
{ | ||
"name": "hqtrivia-api", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "HQ Trivia API wrapper for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -21,2 +21,4 @@ # HQ Trivia API | ||
- `hq.setToken(token)` - Sets token for requests | ||
- `hq.changeUsername(username)` - Change username | ||
- `hq.checkUsername(username)` - Check username | ||
@@ -23,0 +25,0 @@ ## Registration methods |
@@ -119,2 +119,24 @@ const axios = require('axios') | ||
async changeUsername (username) { | ||
if (!this.token) throw new Error('This method cannot be used without authorization') | ||
const changeUsernameResp = await this.axios.patch('/users/me', { | ||
username: username | ||
}) | ||
return changeUsernameResp.data | ||
} | ||
async checkUsername (username) { | ||
if (!this.token) throw new Error('This method cannot be used without authorization') | ||
const checkUsernameResp = await this.axios.post('/usernames/available', { | ||
username: username | ||
}) | ||
return checkUsernameResp.data | ||
} | ||
async easterEgg (type = 'makeItRain') { | ||
if (!this.token) throw new Error('This method cannot be used without authorization') | ||
const easterEggResp = await this.axios.post(`/easter-eggs/${type}`) | ||
return easterEggResp.data | ||
} | ||
async searchUsers (query) { | ||
@@ -121,0 +143,0 @@ if (!this.token) throw new Error('This method cannot be used without authorization') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17711
322
128