feat(CompactLink): Parse subtitle, iconType, and iconType

This commit is contained in:
Luan
2025-01-24 11:22:29 -03:00
parent 32125c7045
commit 6d57353a80

View File

@@ -6,14 +6,27 @@ import type { RawNode } from '../index.js';
export default class CompactLink extends YTNode {
static type = 'CompactLink';
title: string;
endpoint: NavigationEndpoint;
style: string;
public title: string;
public subtitle?: Text;
public endpoint: NavigationEndpoint;
public style: string;
public icon_type?: string;
public secondary_icon_type?: string;
constructor(data: RawNode) {
super();
this.title = new Text(data.title).toString();
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
if ('subtitle' in data)
this.subtitle = new Text(data.subtitle);
if ('icon' in data && 'iconType' in data.icon)
this.icon_type = data.icon.iconType;
if ('secondaryIcon' in data && 'iconType' in data.secondaryIcon)
this.secondary_icon_type = data.secondaryIcon.iconType;
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);
this.style = data.style;
}
}