From 5050f4866b5f631e49dca1bb9955140a484d3f2f Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sat, 21 Dec 2024 04:14:18 +0100 Subject: [PATCH] chore(parser): Hoist API_PATH constants in endpoint nodes (#852) --- .../classes/commands/GetKidsBlocklistPickerCommand.ts | 5 +++-- .../classes/endpoints/AddToPlaylistServiceEndpoint.ts | 6 +++--- src/parser/classes/endpoints/BrowseEndpoint.ts | 6 +++--- src/parser/classes/endpoints/CreateCommentEndpoint.ts | 5 +++-- .../endpoints/CreatePlaylistServiceEndpoint.ts | 5 +++-- .../classes/endpoints/DeletePlaylistEndpoint.ts | 5 +++-- src/parser/classes/endpoints/FeedbackEndpoint.ts | 5 +++-- .../endpoints/GetAccountsListInnertubeEndpoint.ts | 5 +++-- src/parser/classes/endpoints/LikeEndpoint.ts | 11 ++++++----- .../endpoints/LiveChatItemContextMenuEndpoint.ts | 5 +++-- .../ModifyChannelNotificationPreferenceEndpoint.ts | 5 +++-- .../classes/endpoints/PerformCommentActionEndpoint.ts | 5 +++-- src/parser/classes/endpoints/PlaylistEditEndpoint.ts | 5 +++-- src/parser/classes/endpoints/ReelWatchEndpoint.ts | 5 +++-- src/parser/classes/endpoints/SearchEndpoint.ts | 5 +++-- .../classes/endpoints/ShareEntityServiceEndpoint.ts | 5 +++-- src/parser/classes/endpoints/SubscribeEndpoint.ts | 5 +++-- src/parser/classes/endpoints/UnsubscribeEndpoint.ts | 5 +++-- src/parser/classes/endpoints/WatchEndpoint.ts | 5 +++-- src/parser/classes/endpoints/WatchNextEndpoint.ts | 5 +++-- 20 files changed, 63 insertions(+), 45 deletions(-) diff --git a/src/parser/classes/commands/GetKidsBlocklistPickerCommand.ts b/src/parser/classes/commands/GetKidsBlocklistPickerCommand.ts index afdca79fd..971e21392 100644 --- a/src/parser/classes/commands/GetKidsBlocklistPickerCommand.ts +++ b/src/parser/classes/commands/GetKidsBlocklistPickerCommand.ts @@ -1,10 +1,11 @@ import { YTNode } from '../../helpers.js'; import type { GetKidsBlocklistPickerRequest, IEndpoint, RawNode } from '../../index.js'; +const API_PATH = 'kids/get_kids_blocklist_picker'; + export default class GetKidsBlocklistPickerCommand extends YTNode implements IEndpoint { static type = 'GetKidsBlocklistPickerCommand'; - #API_PATH = 'kids/get_kids_blocklist_picker'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class GetKidsBlocklistPickerCommand extends YTNode implements IEn } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): GetKidsBlocklistPickerRequest { diff --git a/src/parser/classes/endpoints/AddToPlaylistServiceEndpoint.ts b/src/parser/classes/endpoints/AddToPlaylistServiceEndpoint.ts index 07359d23f..6977a41b3 100644 --- a/src/parser/classes/endpoints/AddToPlaylistServiceEndpoint.ts +++ b/src/parser/classes/endpoints/AddToPlaylistServiceEndpoint.ts @@ -1,10 +1,10 @@ import { YTNode } from '../../helpers.js'; import type { AddToPlaylistServiceRequest, IEndpoint, RawNode } from '../../index.js'; +const API_PATH = 'playlist/get_add_to_playlist'; + export default class AddToPlaylistServiceEndpoint extends YTNode implements IEndpoint { static type = 'AddToPlaylistServiceEndpoint'; - - #API_PATH = 'playlist/get_add_to_playlist'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +13,7 @@ export default class AddToPlaylistServiceEndpoint extends YTNode implements IEnd } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): AddToPlaylistServiceRequest { diff --git a/src/parser/classes/endpoints/BrowseEndpoint.ts b/src/parser/classes/endpoints/BrowseEndpoint.ts index f6920fb19..fb182b3e7 100644 --- a/src/parser/classes/endpoints/BrowseEndpoint.ts +++ b/src/parser/classes/endpoints/BrowseEndpoint.ts @@ -1,10 +1,10 @@ import { YTNode } from '../../helpers.js'; import type { BrowseRequest, IEndpoint, RawNode } from '../../index.js'; +const API_PATH = 'browse'; + export default class BrowseEndpoint extends YTNode implements IEndpoint { static type = 'BrowseEndpoint'; - - #API_PATH = 'browse'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +13,7 @@ export default class BrowseEndpoint extends YTNode implements IEndpoint { static type = 'CreateCommentEndpoint'; - #API_PATH = 'comment/create_comment'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class CreateCommentEndpoint extends YTNode implements IEndpoint { static type = 'CreatePlaylistServiceEndpoint'; - #API_PATH = 'playlist/create'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class CreatePlaylistServiceEndpoint extends YTNode implements IEn } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): CreatePlaylistServiceRequest { diff --git a/src/parser/classes/endpoints/DeletePlaylistEndpoint.ts b/src/parser/classes/endpoints/DeletePlaylistEndpoint.ts index 8173f190f..ceb66357b 100644 --- a/src/parser/classes/endpoints/DeletePlaylistEndpoint.ts +++ b/src/parser/classes/endpoints/DeletePlaylistEndpoint.ts @@ -1,10 +1,11 @@ import { YTNode } from '../../helpers.js'; import type { DeletePlaylistServiceRequest, IEndpoint, RawNode } from '../../index.js'; +const API_PATH = 'playlist/delete'; + export default class DeletePlaylistEndpoint extends YTNode implements IEndpoint { static type = 'DeletePlaylistEndpoint'; - #API_PATH = 'playlist/delete'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class DeletePlaylistEndpoint extends YTNode implements IEndpoint< } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): DeletePlaylistServiceRequest { diff --git a/src/parser/classes/endpoints/FeedbackEndpoint.ts b/src/parser/classes/endpoints/FeedbackEndpoint.ts index 8215b87cb..7219e92db 100644 --- a/src/parser/classes/endpoints/FeedbackEndpoint.ts +++ b/src/parser/classes/endpoints/FeedbackEndpoint.ts @@ -1,10 +1,11 @@ import { YTNode } from '../../helpers.js'; import type { FeedbackRequest, IEndpoint, RawNode } from '../../index.js'; +const API_PATH = 'feedback'; + export default class FeedbackEndpoint extends YTNode implements IEndpoint { static type = 'FeedbackEndpoint'; - #API_PATH = 'feedback'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class FeedbackEndpoint extends YTNode implements IEndpoint { static type = 'GetAccountsListInnertubeEndpoint'; - #API_PATH = 'account/accounts_list'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class GetAccountsListInnertubeEndpoint extends YTNode implements } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): GetAccountsListInnertubeRequest { diff --git a/src/parser/classes/endpoints/LikeEndpoint.ts b/src/parser/classes/endpoints/LikeEndpoint.ts index 97701954b..9b9bb697c 100644 --- a/src/parser/classes/endpoints/LikeEndpoint.ts +++ b/src/parser/classes/endpoints/LikeEndpoint.ts @@ -1,12 +1,13 @@ import { YTNode } from '../../helpers.js'; import type { IEndpoint, LikeRequest, RawNode } from '../../index.js'; +const LIKE_API_PATH = 'like/like'; +const DISLIKE_API_PATH = 'like/dislike'; +const REMOVE_LIKE_API_PATH = 'like/removelike'; + export default class LikeEndpoint extends YTNode implements IEndpoint { static type = 'LikeEndpoint'; - #LIKE_API_PATH = 'like/like'; - #DISLIKE_API_PATH = 'like/dislike'; - #REMOVE_LIKE_API_PATH = 'like/removelike'; #data: RawNode; constructor(data: RawNode) { @@ -16,8 +17,8 @@ export default class LikeEndpoint extends YTNode implements IEndpoint { static type = 'LiveChatItemContextMenuEndpoint'; - #API_PATH = 'live_chat/get_item_context_menu'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class LiveChatItemContextMenuEndpoint extends YTNode implements I } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): LiveChatItemContextMenuRequest { diff --git a/src/parser/classes/endpoints/ModifyChannelNotificationPreferenceEndpoint.ts b/src/parser/classes/endpoints/ModifyChannelNotificationPreferenceEndpoint.ts index fd22bbce3..000cd422a 100644 --- a/src/parser/classes/endpoints/ModifyChannelNotificationPreferenceEndpoint.ts +++ b/src/parser/classes/endpoints/ModifyChannelNotificationPreferenceEndpoint.ts @@ -1,10 +1,11 @@ import { YTNode } from '../../helpers.js'; import type { IEndpoint, ModifyChannelNotificationPreferenceRequest, RawNode } from '../../index.js'; +const API_PATH = 'notification/modify_channel_preference'; + export default class ModifyChannelNotificationPreferenceEndpoint extends YTNode implements IEndpoint { static type = 'ModifyChannelNotificationPreferenceEndpoint'; - #API_PATH = 'notification/modify_channel_preference'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class ModifyChannelNotificationPreferenceEndpoint extends YTNode } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): ModifyChannelNotificationPreferenceRequest { diff --git a/src/parser/classes/endpoints/PerformCommentActionEndpoint.ts b/src/parser/classes/endpoints/PerformCommentActionEndpoint.ts index 385f89474..cda7c21f4 100644 --- a/src/parser/classes/endpoints/PerformCommentActionEndpoint.ts +++ b/src/parser/classes/endpoints/PerformCommentActionEndpoint.ts @@ -1,10 +1,11 @@ import { YTNode } from '../../helpers.js'; import type { IEndpoint, PerformCommentActionRequest, RawNode } from '../../index.js'; +const API_PATH = 'comment/perform_comment_action'; + export default class PerformCommentActionEndpoint extends YTNode implements IEndpoint { static type = 'PerformCommentActionEndpoint'; - #API_PATH = 'comment/perform_comment_action'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class PerformCommentActionEndpoint extends YTNode implements IEnd } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): PerformCommentActionRequest { diff --git a/src/parser/classes/endpoints/PlaylistEditEndpoint.ts b/src/parser/classes/endpoints/PlaylistEditEndpoint.ts index f6dbfdbb0..a45978994 100644 --- a/src/parser/classes/endpoints/PlaylistEditEndpoint.ts +++ b/src/parser/classes/endpoints/PlaylistEditEndpoint.ts @@ -1,10 +1,11 @@ import { YTNode } from '../../helpers.js'; import type { IEndpoint, PlaylistEditRequest, RawNode } from '../../index.js'; +const API_PATH = 'browse/edit_playlist'; + export default class PlaylistEditEndpoint extends YTNode implements IEndpoint { static type = 'PlaylistEditEndpoint'; - #API_PATH = 'browse/edit_playlist'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class PlaylistEditEndpoint extends YTNode implements IEndpoint { static type = 'ReelWatchEndpoint'; - #API_PATH = 'reel/reel_item_watch'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class ReelWatchEndpoint extends YTNode implements IEndpoint { static type = 'SearchEndpoint'; - #API_PATH = 'search'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class SearchEndpoint extends YTNode implements IEndpoint { static type = 'ShareEntityServiceEndpoint'; - #API_PATH = 'share/get_share_panel'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class ShareEntityServiceEndpoint extends YTNode implements IEndpo } public getApiPath(): string { - return this.#API_PATH; + return API_PATH; } public buildRequest(): ShareEntityServiceRequest { diff --git a/src/parser/classes/endpoints/SubscribeEndpoint.ts b/src/parser/classes/endpoints/SubscribeEndpoint.ts index ff3f6ea54..ad81e4510 100644 --- a/src/parser/classes/endpoints/SubscribeEndpoint.ts +++ b/src/parser/classes/endpoints/SubscribeEndpoint.ts @@ -1,10 +1,11 @@ import { YTNode } from '../../helpers.js'; import type { IEndpoint, RawNode, SubscribeRequest } from '../../index.js'; +const API_PATH = 'subscription/subscribe'; + export default class SubscribeEndpoint extends YTNode implements IEndpoint { static type = 'SubscribeEndpoint'; - #API_PATH = 'subscription/subscribe'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class SubscribeEndpoint extends YTNode implements IEndpoint { static type = 'UnsubscribeEndpoint'; - #API_PATH = 'subscription/unsubscribe'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class UnsubscribeEndpoint extends YTNode implements IEndpoint { static type = 'WatchEndpoint'; - #API_PATH = 'player'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class WatchEndpoint extends YTNode implements IEndpoint { static type = 'WatchNextEndpoint'; - #API_PATH = 'next'; #data: RawNode; constructor(data: RawNode) { @@ -13,7 +14,7 @@ export default class WatchNextEndpoint extends YTNode implements IEndpoint