mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-15 10:32:14 +00:00
* dev: finish top-level parsers TS migration
* dev: migrate menu renderers to TS
* chore: fix ts errors
* dev: finish ts migration 🎉
31 lines
839 B
TypeScript
31 lines
839 B
TypeScript
import NavigationEndpoint from './NavigationEndpoint';
|
|
import Text from './misc/Text';
|
|
import Thumbnail from './misc/Thumbnail';
|
|
import { YTNode } from '../helpers';
|
|
|
|
class HeaderLink {
|
|
endpoint: NavigationEndpoint;
|
|
icon: Thumbnail[];
|
|
title: Text;
|
|
|
|
constructor(data: any) {
|
|
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
|
|
this.icon = Thumbnail.fromResponse(data.icon);
|
|
this.title = new Text(data.title);
|
|
}
|
|
}
|
|
|
|
class ChannelHeaderLinks extends YTNode {
|
|
static type = 'ChannelHeaderLinks';
|
|
|
|
primary: HeaderLink[];
|
|
secondary: HeaderLink[];
|
|
|
|
constructor(data: any) {
|
|
super();
|
|
this.primary = data.primaryLinks?.map((link: any) => new HeaderLink(link)) || [];
|
|
this.secondary = data.secondaryLinks?.map((link: any) => new HeaderLink(link)) || [];
|
|
}
|
|
}
|
|
|
|
export default ChannelHeaderLinks; |