Socket
Socket
Sign inDemoInstall

twitch-new-api

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 2.0.0

dist/index.js

30

package.json
{
"name": "twitch-new-api",
"version": "1.2.0",
"description": "Twitch New Api",
"main": "index.js",
"version": "2.0.0",
"description": "Twitchfa Helix Api Wrapper in TypeScript",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "tsc",
"build:watch": "tsc -w",
"start": "nodemon dist/index.js",
"test": "npx jest",
"test:watch": "npx jest --watch"
},
"keywords": [],
"author": "Soroosh Merajiyan <sorooshmerajiyan@gmail.com> (https://www.linkedin.com/in/sorooshmerajiyan)",
"keywords": [
"Twitch",
"Helix"
],
"author": "Soroosh Merajiyan",
"license": "MIT",
"devDependencies": {
"@types/jest": "26.0.15",
"@types/node": "14.14.7",
"@types/node-fetch": "2.5.7",
"jest": "26.6.3",
"nodemon": "2.0.6",
"ts-jest": "26.4.4",
"typescript": "4.0.5"
},
"dependencies": {
"node-fetch": "^2.6.0"
"node-fetch": "2.6.1"
}
}

@@ -1,37 +0,33 @@

# Introduction
# Install
a simple package to interact with **Twitch's _new_ API**
```
npm i twitch-new-api
```
# How to use
# Basic Usage
```javascript
const TwitchApi = require(`twitch-new-api`);
This package is written in TypeScript, so you can use it in both js and ts.
const clientId = `yourClientId`;
const clientSecret = `yourClientSecret`;
All of the methods are self documented, providing a good developer experience.
const TwitchClient = new TwitchApi(clientId, clientSecret);
```ts
import { TwitchApi, TwitchCredentials } from '../src';
const twitchCredentials: TwitchCredentials = {
id: 'twitch.client.id',
secret: 'twitch.client.secret',
};
const twitch = new TwitchApi(twitchCredentials);
(async () => {
let data = await TwitchClient.getUserByLogin(user);
console.log(data);
const user = await twitch.getUserById(['mechiller']);
const profilePicture = user[0].profile_image_url;
})();
```
# Methods
# Contribution
```javascript
TwitchClient.getGameById(gameId); // gets Game Name from Game ID - Example: 33214
TwitchClient.getStreamById(userId); // gets stream data if live by User ID - Example: 12826
TwitchClient.getStreamByLogin(userLogin); // gets stream data if live by User Login - Example: twitch
TwitchClient.getUserById(userId); // gets user data from User ID - Example: 12826
TwitchClient.getUserByLogin(userLogin); // gets user data from User Login - Example: twitch
TwitchClient.getAllFollowersToId(userId); // gets all of followers from User ID - Example: 12826
TwitchClient.getFollowersToId(userId, number); // gets a number followers from User ID - Example: 12826, 20
TwitchClient.getAllFollowersFromId(userId); // gets all of followings from User ID - Example: 12826
TwitchClient.getFollowersFromId(userId, number); // gets a number of followings from User ID - Example: 12826, 20
TwitchClient.getStreamsFromId(ids); // gets an array of live streams from User IDs - Example: [12826, ...]
TwitchClient.getStreamsFromLogin(logins); // gets an array of live streams from User Logins - Example: [12826, ...]
```
I made this package for my own usage, if you need something specific, please, make an issue or PR.
# License - MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc