Node API Client for Streamsource
Highly volatile; breaking changes will be committed unapologetically
npm install streamsource-client
Certain methods may require an authenticated and/or authorized JSON Web Token. To obtain this token, follow the steps documented in the Streamsource README.
// Create an API client with your JWT
const StreamsourceClient = require('streamsource-client')
const streamsource = StreamsourceClient(YOUR_STREAMSOURCE_JWT)
// Search for streams
const streamsData = await streamsource.getStreamsData({
notPlatform: 'WSDOT',
isExpired: false,
isPinned: false,
orderFields: ['createdAt'].join(','),
orderDirections: ['DESC'].join(','),
})
// Get info on a specific stream
const streamData = await streamsource.getStreamData(12345)
// Add a new stream
const streamOptions = {
link: 'https://my-stream-url.com/',
postedBy: 'My Bot Name',
city: 'Seattle',
region: 'WA',
}
await streamsource.createStream(streamOptions)
// Update a stream
const updatedStream = await streamsource.updateStream({id: 12345, status: 'Live'})
// Expire a stream
await streamsource.expireStream(12345)