Files
epg/scripts/models/apiGuide.ts

50 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-05-04 18:01:51 +03:00
import { WorkerGuideSource } from './worker'
export interface ApiGuideData {
channel: string | null
feed: string | null
site: string
site_id: string
site_name: string
lang: string | null
sources?: WorkerGuideSource[]
}
export class ApiGuide {
channel: string | null
feed: string | null
site: string
site_id: string
site_name: string
lang: string
sources: WorkerGuideSource[] = []
constructor(data: ApiGuideData) {
this.channel = data.channel || null
this.feed = data.feed || null
this.site = data.site
this.site_id = data.site_id
this.site_name = data.site_name
this.lang = data.lang || 'en'
this.sources = data.sources || []
}
addSource(source: ApiGuideSource): this {
this.sources.push(source)
return this
}
toJSON(): ApiGuideData {
return {
channel: this.channel,
feed: this.feed,
site: this.site,
site_id: this.site_id,
site_name: this.site_name,
lang: this.lang,
sources: this.sources
}
}
}