![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
ts-twitch-api
Advanced tools
Very simple TwitchApi class and TypeScript interfaces for all Twitch API endpoints
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
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 0 open source maintainers 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.