import log from '../util/Logger' ; import NI from '../util/NetworkInterface' ; import * as queries from '../scripts/streamQueries' ; import { IStream , IStreamData , IStreamDataFull } from '../interfaces/IStream' ; export class Stream implements IStream { public static parseFull ( data ) { return Stream . parse ( data . stream ) ; } public static async get ( theId ) { log . info ( 'Getting Stream with Id %s' , theId ) ; const data = await NI . query ( queries . stream , { id : theId } ) ; return Stream . parseFull ( data ) ; } public static parse ( data ) { return new Stream ( data . id , data . eventId , data . tournamentId , data . streamName , data . numSetups , data . streamSource , data . streamType , data . streamTypeId , data . isOnline , data . enabled , data . followerCount , data . removesTasks , data . streamStatus , data . streamGame , data . streamLogo ) ; } private id : number ; private eventId : number | null ; private tournamentId : number | null ; private streamName : string ; private numSetups : number | null ; private streamSource : 'TWITCH' | 'HITBOX' | 'STREAMME' | 'MIXER' | null ; private streamType : number | null ; private streamTypeId : number | null ; private isOnline : boolean | null ; private enabled : boolean | null ; private followerCount : number | null ; private removesTasks : boolean | null ; private streamStatus : string | null ; private streamGame : string | null ; private streamLogo : string | null ; constructor ( id , eventId , tournamentId , streamName , numSetups , streamSource , streamType , streamTypeId , isOnline , enabled , followerCount , removesTasks , streamStatus , streamGame , streamLogo ) { this . id = id ; this . eventId = eventId ; this . tournamentId = tournamentId ; this . streamName = streamName ; this . numSetups = numSetups ; this . streamSource = streamSource ; this . streamType = streamType ; this . streamTypeId = streamTypeId ; this . isOnline = isOnline ; this . enabled = enabled ; this . followerCount = followerCount ; this . removesTasks = removesTasks ; this . streamStatus = streamStatus ; this . streamGame = streamGame ; this . streamLogo = streamLogo ; } public getId ( ) { return this . id ; } public getEventId ( ) { return this . eventId ; } public getTournamentId ( ) { return this . tournamentId ; } public getStreamName ( ) { return this . streamName ; } public getNumSetups ( ) { return this . numSetups ; } public getStreamSource ( ) { return this . streamSource ; } public getStreamType ( ) { return this . streamType ; } public getStreamTypeId ( ) { return this . streamTypeId ; } public getIsOnline ( ) { return this . isOnline ; } public getEnabled ( ) { return this . enabled ; } public getFollowerCount ( ) { return this . followerCount ; } public getRemovesTasks ( ) { return this . removesTasks ; } public getStreamStatus ( ) { return this . streamStatus ; } public getStreamGame ( ) { return this . streamGame ; } public getStreamLogo ( ) { return this . streamLogo ; } }