Files
YouTube.js/src/parser/classes/Notification.ts
LuanRT 34281e2445 refactor: migrate parsers to TS (#133)
* dev: finish top-level parsers TS migration

* dev: migrate menu renderers to TS

* chore: fix ts errors

* dev: finish ts migration 🎉
2022-08-20 03:18:17 -03:00

34 lines
1.1 KiB
TypeScript

import Parser from '../index';
import Text from './misc/Text';
import Thumbnail from './misc/Thumbnail';
import NavigationEndpoint from './NavigationEndpoint';
import { YTNode } from '../helpers';
class Notification extends YTNode {
static type = 'Notification';
thumbnails: Thumbnail[];
video_thumbnails: Thumbnail[];
short_message: Text;
sent_time: Text;
notification_id: any;
endpoint: NavigationEndpoint;
record_click_endpoint: NavigationEndpoint;
menu;
read: boolean;
constructor(data: any) {
super();
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
this.video_thumbnails = Thumbnail.fromResponse(data.videoThumbnail);
this.short_message = new Text(data.shortMessage);
this.sent_time = new Text(data.sentTimeText);
this.notification_id = data.notificationId;
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
this.record_click_endpoint = new NavigationEndpoint(data.recordClickEndpoint);
this.menu = Parser.parse(data.contextualMenu);
this.read = data.read;
}
}
export default Notification;