Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ts-twitch-api
Advanced tools
Readme
Very simple TwitchApi
class and TypeScript interfaces for all Twitch API endpoints
fetch
under the hoodnpm i ts-twitch-api
pnpm i ts-twitch-api
yarn add ts-twitch-api
import type {
UpdateAutoModSettingsParams,
UpdateAutoModSettingsBody,
UpdateAutoModSettingsResponse,
} from 'ts-twitch-api';
const updateAutoModSettings = async (
params: UpdateAutoModSettingsParams,
body: UpdateAutoModSettingsBody,
) => {
const searchParams = new URLSearchParams(params);
const url = `https://api.twitch.tv/helix/moderation/automod/settings?${searchParams}`;
const response = await fetch(url, {
method: 'PUT',
body: JSON.stringify(body),
headers: {
Authorization: `Bearer ${process.env.ACCESS_TOKEN}`,
'Client-Id': process.env.CLIENT_ID,
'Content-Type': 'application/json',
},
});
return response.json() as Promise<UpdateAutoModSettingsResponse>;
}
TwitchApi
classimport { TwitchApi } from 'ts-twitch-api';
const twitchApi = new TwitchApi({
accessToken: process.env.ACCESS_TOKEN,
clientId: process.env.CLIENT_ID,
});
const response = await twitchApi.chat.updateChatSettings(
// query params
{ broadcaster_id: '1', moderator_id: '2' },
// body
{ emote_mode: true },
);
if (response.ok) {
console.log(response.data);
} else {
console.error(response.status);
}
const streams = await twitchApi.streams.getStreams(
// some endpoints accept multiple ids like this: `id=1234&id=5678`
{ user_id: ['1', '2'] },
// override accessToken and/or clientId for different requests
{
accessToken: '<accessToken>',
clientId: '<clientId>'
},
);
if (streams.ok) {
console.log(streams.data);
}
// pass fetch options via RequestInit object
const ac = new AbortController();
const users = twitchApi.users.getUsers(
{ id: ['1', '2'] },
{ requestInit: { signal: ac.signal } },
);
ac.abort();
FAQs
Very simple TwitchApi class and TypeScript interfaces for all Twitch API endpoints
The npm package ts-twitch-api receives a total of 8 weekly downloads. As such, ts-twitch-api popularity was classified as not popular.
We found that ts-twitch-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.