twitch-api-lite
Advanced tools
Comparing version 0.0.2 to 0.0.3
32
index.js
@@ -12,3 +12,3 @@ const request = require("request"); | ||
*/ | ||
isTwitchUserLive(clientID, streamerUsername) | ||
isStreamerLiveByUsername(clientID, streamerUsername) | ||
{ | ||
@@ -33,4 +33,34 @@ return new Promise(function (fulfill, reject) | ||
}) | ||
}, | ||
/** | ||
* Returns the public data for a streamer queried by their username. An empty array will | ||
* be returned if the streamer is not live | ||
* | ||
* @param clientID your twitch app client id | ||
* @param streamerUsername the users stream url extension eg: twitch.tv/inflamesforever | ||
* @returns {Promise<JSON Object>} | ||
*/ | ||
getStreamDetailsByUsername(clientID, streamerUsername) | ||
{ | ||
return new Promise(function (fulfill, reject) | ||
{ | ||
try | ||
{ | ||
request({ | ||
headers: { | ||
'Client-ID': clientID | ||
}, uri: 'https://api.twitch.tv/helix/streams?user_login=' + streamerUsername, method: 'GET' | ||
}, function (url, res, body) | ||
{ | ||
fulfill(JSON.parse(body).data) | ||
}) | ||
} | ||
catch (ex) | ||
{ | ||
reject(ex) | ||
} | ||
}) | ||
} | ||
}; |
{ | ||
"name": "twitch-api-lite", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "This package provides small lightweight functions that are to be used with the Twitch API v5", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
38614
59