kick-sdk
Version:
NodeJS lightweight SDK for Kick.com API.
29 lines (28 loc) • 1.04 kB
JavaScript
import { EApiEndpoint } from '../utils/models/enumerations/apiEndpoint';
import { api } from '../utils/services/api';
export class ChannelService {
client;
constructor(client) {
this.client = client;
}
async getMyChannel() {
return await api(EApiEndpoint.GET_CHANNELS, this.client.getToken());
}
async getChannels(ids) {
const params = new URLSearchParams();
ids.forEach(id => params.append('broadcaster_user_id', id.toString()));
return await api(`${EApiEndpoint.GET_CHANNELS}?${params}`, this.client.getToken());
}
async getChannelById(id) {
return await api(`${EApiEndpoint.GET_CHANNELS}?broadcaster_user_id=${id}`, this.client.getToken());
}
async setLiveStream(categoryId, streamTitle) {
return await api(EApiEndpoint.GET_CHANNELS, this.client.getToken(), {
method: 'PATCH',
body: JSON.stringify({
category_id: categoryId,
stream_title: streamTitle
})
});
}
}