Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(parser): Hoist API_PATH constants in endpoint nodes #852

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/parser/classes/commands/GetKidsBlocklistPickerCommand.ts
Original file line number Diff line number Diff line change
@@ -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<GetKidsBlocklistPickerRequest> {
static type = 'GetKidsBlocklistPickerCommand';

#API_PATH = 'kids/get_kids_blocklist_picker';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/parser/classes/endpoints/AddToPlaylistServiceEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<AddToPlaylistServiceRequest> {
static type = 'AddToPlaylistServiceEndpoint';

#API_PATH = 'playlist/get_add_to_playlist';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/parser/classes/endpoints/BrowseEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<BrowseRequest> {
static type = 'BrowseEndpoint';

#API_PATH = 'browse';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +13,7 @@ export default class BrowseEndpoint extends YTNode implements IEndpoint<BrowseRe
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): BrowseRequest {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/CreateCommentEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { CreateCommentRequest, IEndpoint, RawNode } from '../../index.js';

const API_PATH = 'comment/create_comment';

export default class CreateCommentEndpoint extends YTNode implements IEndpoint<CreateCommentRequest> {
static type = 'CreateCommentEndpoint';

#API_PATH = 'comment/create_comment';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class CreateCommentEndpoint extends YTNode implements IEndpoint<C
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): CreateCommentRequest {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/CreatePlaylistServiceEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { CreatePlaylistServiceRequest, IEndpoint, RawNode } from '../../index.js';

const API_PATH = 'playlist/create';

export default class CreatePlaylistServiceEndpoint extends YTNode implements IEndpoint<CreatePlaylistServiceRequest> {
static type = 'CreatePlaylistServiceEndpoint';

#API_PATH = 'playlist/create';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/DeletePlaylistEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<DeletePlaylistServiceRequest> {
static type = 'DeletePlaylistEndpoint';

#API_PATH = 'playlist/delete';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/FeedbackEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<FeedbackRequest> {
static type = 'FeedbackEndpoint';

#API_PATH = 'feedback';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class FeedbackEndpoint extends YTNode implements IEndpoint<Feedba
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): FeedbackRequest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { GetAccountsListInnertubeRequest, IEndpoint, RawNode } from '../../index.js';

const API_PATH = 'account/accounts_list';

export default class GetAccountsListInnertubeEndpoint extends YTNode implements IEndpoint<GetAccountsListInnertubeRequest> {
static type = 'GetAccountsListInnertubeEndpoint';

#API_PATH = 'account/accounts_list';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class GetAccountsListInnertubeEndpoint extends YTNode implements
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): GetAccountsListInnertubeRequest {
Expand Down
11 changes: 6 additions & 5 deletions src/parser/classes/endpoints/LikeEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<LikeRequest> {
static type = 'LikeEndpoint';

#LIKE_API_PATH = 'like/like';
#DISLIKE_API_PATH = 'like/dislike';
#REMOVE_LIKE_API_PATH = 'like/removelike';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -16,8 +17,8 @@ export default class LikeEndpoint extends YTNode implements IEndpoint<LikeReques

public getApiPath(): string {
return this.#data.status === 'DISLIKE' ?
this.#DISLIKE_API_PATH : this.#data.status === 'INDIFFERENT' ?
this.#REMOVE_LIKE_API_PATH : this.#LIKE_API_PATH;
DISLIKE_API_PATH : this.#data.status === 'INDIFFERENT' ?
REMOVE_LIKE_API_PATH : LIKE_API_PATH;
}

public buildRequest(): LikeRequest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { IEndpoint, RawNode, LiveChatItemContextMenuRequest } from '../../index.js';

const API_PATH = 'live_chat/get_item_context_menu';

export default class LiveChatItemContextMenuEndpoint extends YTNode implements IEndpoint<LiveChatItemContextMenuRequest> {
static type = 'LiveChatItemContextMenuEndpoint';

#API_PATH = 'live_chat/get_item_context_menu';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ModifyChannelNotificationPreferenceRequest> {
static type = 'ModifyChannelNotificationPreferenceEndpoint';

#API_PATH = 'notification/modify_channel_preference';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class ModifyChannelNotificationPreferenceEndpoint extends YTNode
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): ModifyChannelNotificationPreferenceRequest {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/PerformCommentActionEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<PerformCommentActionRequest> {
static type = 'PerformCommentActionEndpoint';

#API_PATH = 'comment/perform_comment_action';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/PlaylistEditEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<PlaylistEditRequest> {
static type = 'PlaylistEditEndpoint';

#API_PATH = 'browse/edit_playlist';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class PlaylistEditEndpoint extends YTNode implements IEndpoint<Pl
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): PlaylistEditRequest {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/ReelWatchEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { IEndpoint, RawNode, ReelWatchRequest } from '../../index.js';

const API_PATH = 'reel/reel_item_watch';

export default class ReelWatchEndpoint extends YTNode implements IEndpoint<ReelWatchRequest> {
static type = 'ReelWatchEndpoint';

#API_PATH = 'reel/reel_item_watch';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class ReelWatchEndpoint extends YTNode implements IEndpoint<ReelW
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): ReelWatchRequest {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/SearchEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { IEndpoint, RawNode, SearchRequest } from '../../index.js';

const API_PATH = 'search';

export default class SearchEndpoint extends YTNode implements IEndpoint<SearchRequest> {
static type = 'SearchEndpoint';

#API_PATH = 'search';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class SearchEndpoint extends YTNode implements IEndpoint<SearchRe
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): SearchRequest {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/ShareEntityServiceEndpoint.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { IEndpoint, RawNode, ShareEntityServiceRequest } from '../../index.js';

const API_PATH = 'share/get_share_panel';

export default class ShareEntityServiceEndpoint extends YTNode implements IEndpoint<ShareEntityServiceRequest> {
static type = 'ShareEntityServiceEndpoint';

#API_PATH = 'share/get_share_panel';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/parser/classes/endpoints/SubscribeEndpoint.ts
Original file line number Diff line number Diff line change
@@ -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<SubscribeRequest> {
static type = 'SubscribeEndpoint';

#API_PATH = 'subscription/subscribe';
#data: RawNode;

constructor(data: RawNode) {
Expand All @@ -13,7 +14,7 @@ export default class SubscribeEndpoint extends YTNode implements IEndpoint<Subsc
}

public getApiPath(): string {
return this.#API_PATH;
return API_PATH;
}

public buildRequest(): SubscribeRequest {
Expand Down
Loading
Loading