chore: update type definitions

This commit is contained in:
LuanRT
2022-06-10 15:06:27 -03:00
parent 53965630b7
commit 95f713ff53
29 changed files with 327 additions and 47 deletions

View File

@@ -57,6 +57,7 @@ declare class Innertube {
account: AccountManager;
playlist: PlaylistManager;
interact: InteractionManager;
music: YTMusic;
/**
* Signs in to a google account.
*
@@ -334,6 +335,7 @@ import Actions = require("./core/Actions");
import AccountManager = require("./core/AccountManager");
import PlaylistManager = require("./core/PlaylistManager");
import InteractionManager = require("./core/InteractionManager");
import YTMusic = require("./core/Music");
import VideoInfo = require("./parser/youtube/VideoInfo");
import Search = require("./parser/youtube/Search");
import Stream = require("stream");

17
typings/lib/core/Music.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
export = Music;
/** @namespace */
declare class Music {
/**
* @param {Innertube} session
* @constructor
*/
constructor(session: Innertube);
/**
* Search on YouTube Music.
* @param {string} query
* @returns {Promise.<Search>}
*/
search(query: string): Promise<Search>;
#private;
}
import Search = require("../parser/ytmusic/Search");

View File

@@ -2,9 +2,8 @@ export = ChipCloudChip;
declare class ChipCloudChip {
constructor(data: any);
type: string;
text: Text;
text: any;
endpoint: NavigationEndpoint;
is_selected: any;
}
import Text = require("./Text");
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -0,0 +1,9 @@
export = DidYouMean;
declare class DidYouMean {
constructor(data: any);
type: string;
corrected_query: Text;
endpoint: NavigationEndpoint;
}
import Text = require("./Text");
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -0,0 +1,9 @@
export = EmergencyOnebox;
declare class EmergencyOnebox {
constructor(data: any);
type: string;
title: Text;
first_option: any;
menu: any;
}
import Text = require("./Text");

View File

@@ -0,0 +1,17 @@
export = MerchandiseItem;
declare class MerchandiseItem {
constructor(data: any);
type: string;
title: any;
description: any;
thumbnails: any;
price: any;
vendor_name: any;
button_text: any;
button_accessibility_text: any;
from_vendor_text: any;
additional_fees_text: any;
region_format: any;
endpoint: NavigationEndpoint;
}
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -0,0 +1,8 @@
export = MerchandiseShelf;
declare class MerchandiseShelf {
constructor(data: any);
type: string;
title: any;
menu: any;
items: any;
}

View File

@@ -0,0 +1,6 @@
export = Message;
declare class Message {
constructor(data: any);
type: string;
text: any;
}

View File

@@ -0,0 +1,6 @@
export = MusicHeader;
declare class MusicHeader {
constructor(data: any);
type: string;
header: any;
}

View File

@@ -0,0 +1,7 @@
export = MusicInlineBadge;
declare class MusicInlineBadge {
constructor(data: any);
type: string;
icon_type: any;
label: any;
}

View File

@@ -0,0 +1,8 @@
export = MusicItemThumbnailOverlay;
declare class MusicItemThumbnailOverlay {
constructor(data: any);
type: string;
content: any;
content_position: any;
display_style: any;
}

View File

@@ -0,0 +1,12 @@
export = MusicPlayButton;
declare class MusicPlayButton {
constructor(data: any);
type: string;
endpoint: NavigationEndpoint;
play_icon_type: any;
pause_icon_type: any;
play_label: any;
pause_label: any;
icon_color: any;
}
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -0,0 +1,38 @@
export = MusicResponsiveListItem;
declare class MusicResponsiveListItem {
constructor(data: any, ctx: any);
type: any;
endpoint: NavigationEndpoint;
thumbnails: any;
badges: any;
menu: any;
overlay: any;
id: any;
title: any;
artist: any;
album: any;
duration: {
text: any;
seconds: number;
} | {
text: any;
seconds: number;
};
views: any;
author: {
name: any;
channel_id: any;
} | {
name: any;
channel_id: any;
} | {
name: any;
channel_id: any;
};
name: any;
subscribers: any;
year: any;
item_count: number;
#private;
}
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -0,0 +1,8 @@
export = MusicResponsiveListItemFlexColumn;
declare class MusicResponsiveListItemFlexColumn {
constructor(data: any);
type: string;
title: Text;
display_priority: any;
}
import Text = require("./Text");

View File

@@ -0,0 +1,12 @@
export = MusicShelf;
declare class MusicShelf {
constructor(data: any);
type: string;
title: Text;
contents: any;
endpoint: NavigationEndpoint;
continuation: any;
bottom_text: Text;
}
import Text = require("./Text");
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -2,12 +2,7 @@ export = NavigationEndpoint;
declare class NavigationEndpoint {
constructor(data: any);
type: string;
metadata: {
url: any;
page_type: any;
api_url: any;
send_post: any;
};
metadata: {};
browse: {
id: any;
params: any;
@@ -20,6 +15,10 @@ declare class NavigationEndpoint {
index: any;
supported_onesie_config: any;
};
search: {
query: any;
params: any;
};
subscribe: {
channel_ids: any;
params: any;
@@ -32,6 +31,7 @@ declare class NavigationEndpoint {
status: any;
target: {
video_id: any;
playlist_id: any;
};
remove_like_params: any;
};
@@ -64,7 +64,7 @@ declare class NavigationEndpoint {
get_report_form: {
params: any;
};
call(actions: any): Promise<{
call(actions: any, client: any): Promise<{
contents: any;
on_response_received_actions: any;
on_response_received_endpoints: any;
@@ -79,6 +79,7 @@ declare class NavigationEndpoint {
player_overlays: any;
playability_status: {
status: number;
error_screen: any;
embeddable: boolean;
reason: string;
};

View File

@@ -0,0 +1,11 @@
export = PlayerErrorMessage;
declare class PlayerErrorMessage {
constructor(data: any);
type: string;
subreason: Text;
reason: Text;
proceed_button: any;
thumbnails: any;
icon_type: any;
}
import Text = require("./Text");

View File

@@ -4,4 +4,5 @@ declare class SectionList {
type: string;
target_id: any;
contents: any;
header: any;
}

View File

@@ -0,0 +1,10 @@
export = ShowingResultsFor;
declare class ShowingResultsFor {
constructor(data: any);
type: string;
corrected_query: Text;
endpoint: NavigationEndpoint;
original_query_endpoint: NavigationEndpoint;
}
import Text = require("./Text");
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -0,0 +1,12 @@
export = SingleActionEmergencySupport;
declare class SingleActionEmergencySupport {
constructor(data: any);
type: string;
action_text: Text;
nav_text: Text;
details: Text;
icon_type: any;
endpoint: NavigationEndpoint;
}
import Text = require("./Text");
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -0,0 +1,12 @@
export = ToggleMenuServiceItem;
declare class ToggleMenuServiceItem {
constructor(data: any);
type: string;
text: Text;
toggled_text: Text;
icon_type: any;
toggled_icon_type: any;
endpoint: NavigationEndpoint;
}
import Text = require("./Text");
import NavigationEndpoint = require("./NavigationEndpoint");

View File

@@ -18,6 +18,7 @@ declare class Parser {
playability_status: {
/** @type {number} */
status: number;
error_screen: any;
/** @type {boolean} */
embeddable: boolean;
/** @type {string} */
@@ -43,12 +44,13 @@ declare class Parser {
};
static parseRR(actions: any): any;
static parseFormats(formats: any): any;
static parse(data: any): any;
static parse(data: any, ctx: any): any;
static formatError({ classname, classdata, err }: {
classname: any;
classdata: any;
err: any;
}): void;
static sanitizeClassName(input: any): any;
static shouldIgnore(classname: any): boolean;
}
import VideoDetails = require("./classes/VideoDetails");

View File

@@ -22,6 +22,7 @@ declare class Analytics {
player_overlays: any;
playability_status: {
status: number;
error_screen: any;
embeddable: boolean;
reason: string;
};

View File

@@ -3,11 +3,11 @@ export = History;
declare class History {
/**
* @param {object} page - parsed data.
* @param {import('./Actions')} actions
* @param {import('../../core/Actions')} actions
* @param {boolean} is_continuation
* @constructor
*/
constructor(page: object, actions: any, is_continuation: boolean);
constructor(page: object, actions: import('../../core/Actions'), is_continuation: boolean);
sections: any;
getContinuation(): Promise<History>;
get has_continuation(): boolean;

View File

@@ -3,10 +3,10 @@ export = Library;
declare class Library {
/**
* @param {object} response - API response.
* @param {import('./Actions')} actions
* @param {import('../../core/Actions')} actions
* @constructor
*/
constructor(response: object, actions: any);
constructor(response: object, actions: import('../../core/Actions'));
profile: {
stats: any;
user_info: any;
@@ -27,6 +27,7 @@ declare class Library {
player_overlays: any;
playability_status: {
status: number;
error_screen: any;
embeddable: boolean;
reason: string;
};

View File

@@ -3,11 +3,11 @@ export = Search;
declare class Search {
/**
* @param {object} response - API response.
* @param {import('./Actions')} actions
* @param {import('../../core/Actions')} actions
* @param {boolean} is_continuation
* @constructor
*/
constructor(response: object, actions: any, is_continuation: boolean);
constructor(response: object, actions: import('../../core/Actions'), is_continuation: boolean);
estimated_results: any;
refinements: any;
results: any;

View File

@@ -3,32 +3,36 @@ export = VideoInfo;
declare class VideoInfo {
/**
* @param {object} data - API response.
* @param {import('./Actions')} actions
* @param {import('./Player')} player
* @param {import('../../core/Actions')} actions
* @param {import('../../core/Player')} player
* @constructor
*/
constructor(data: object, actions: any, player: any);
constructor(data: object, actions: import('../../core/Actions'), player: import('../../core/Player'));
/**
* @type {import('../parser/contents/classes/VideoDetails')}
* @type {import('../contents/classes/VideoDetails')}
*/
basic_info: any;
basic_info: import('../contents/classes/VideoDetails');
/**
* @type {import('../parser/contents/classes/VideoPrimaryInfo')}
* @type {import('../contents/classes/VideoPrimaryInfo')}
*/
primary_info: any;
primary_info: import('../contents/classes/VideoPrimaryInfo');
/**
* @type {import('../parser/contents/classes/VideoSecondaryInfo')}
* @type {import('../contents/classes/VideoSecondaryInfo')}
*/
secondary_info: any;
secondary_info: import('../contents/classes/VideoSecondaryInfo');
/**
* @type {import('../parser/contents/classes/ChipCloud')}
* @type {import('../contents/classes/MerchandiseShelf')}
*/
related_chip_cloud: any;
merchandise: import('../contents/classes/MerchandiseShelf');
/**
* @type {import('../contents/classes/ChipCloud')}
*/
related_chip_cloud: import('../contents/classes/ChipCloud');
watch_next_feed: any;
/**
* @type {import('../parser/contents/classes/PlayerOverlay')}
* @type {import('../contents/classes/PlayerOverlay')}
*/
player_overlays: any;
player_overlays: import('../contents/classes/PlayerOverlay');
streaming_data: {
expires: Date;
formats: import("../contents/classes/Format")[];
@@ -38,35 +42,47 @@ declare class VideoInfo {
};
playability_status: {
status: number;
error_screen: any;
embeddable: boolean;
reason: string; /**
* @type {import('../parser/contents/classes/ChipCloud')}
*/
reason: string;
};
/**
* @type {import('../parser/contents/classes/PlayerAnnotationsExpanded')[]}
* @type {import('../contents/classes/PlayerAnnotationsExpanded')[]}
*/
annotations: any[];
annotations: import('../contents/classes/PlayerAnnotationsExpanded')[];
/**
* @type {import('../parser/contents/classes/PlayerStoryboardSpec')}
* @type {import('../contents/classes/PlayerStoryboardSpec')}
*/
storyboards: any;
storyboards: import('../contents/classes/PlayerStoryboardSpec');
/**
* @type {import('../parser/contents/classes/Endscreen')}
* @type {import('../contents/classes/Endscreen')}
*/
endscreen: any;
endscreen: import('../contents/classes/Endscreen');
/**
* @type {import('../parser/contents/classes/PlayerCaptionsTracklist')}
* @type {import('../contents/classes/PlayerCaptionsTracklist')}
*/
captions: any;
captions: import('../contents/classes/PlayerCaptionsTracklist');
/**
* @type {import('../parser/contents/classes/CardCollection')}
* @type {import('../contents/classes/CardCollection')}
*/
cards: any;
cards: import('../contents/classes/CardCollection');
/**
* @type {import('../parser/contents/classes/CommentsEntryPointHeader')}
* @type {import('../contents/classes/CommentsEntryPointHeader')}
*/
comments_entry_point_header: any;
comments_entry_point_header: import('../contents/classes/CommentsEntryPointHeader');
/**
* Applies given filter to the watch next feed.
* @param {string} name
* @returns {Promise.<VideoInfo>}
*/
selectFilter(name: string): Promise<VideoInfo>;
/**
* Retrieves watch next feed continuation.
* @returns {Promise.<CompactVideo[] | CompactMix[]>}
*/
getWatchNextContinuation(): Promise<CompactVideo[] | CompactMix[]>;
/** @type {string[]} */
get filters(): string[];
get page(): {
contents: any;
on_response_received_actions: any;
@@ -82,10 +98,9 @@ declare class VideoInfo {
player_overlays: any;
playability_status: {
status: number;
error_screen: any;
embeddable: boolean;
reason: string; /**
* @type {import('../parser/contents/classes/ChipCloud')}
*/
reason: string;
};
streaming_data: {
expires: Date;
@@ -99,6 +114,9 @@ declare class VideoInfo {
annotations: any;
storyboards: any;
endscreen: import("../contents/classes/Endscreen");
/**
* @type {import('../contents/classes/PlayerAnnotationsExpanded')[]}
*/
cards: import("../contents/classes/CardCollection");
}[];
#private;

45
typings/lib/parser/ytmusic/Search.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
export = Search;
/** @namespace */
declare class Search {
/**
* @param {object} response - API response.
* @param {import('../../core/Actions')} actions
* @param {boolean} is_continuation
* @constructor
*/
constructor(response: object, actions: import('../../core/Actions'), is_continuation: boolean);
/**
* @type {import('../contents/classes/DidYouMean')}
*/
did_you_mean: import('../contents/classes/DidYouMean');
/**
* @type {import('../contents/classes/ShowingResultsFor')}
*/
showing_results_for: import('../contents/classes/ShowingResultsFor');
results: any;
sections: any;
getContinuation(): Promise<Search>;
/**
* Applies given filter to the search.
* @param {string} name
* @returns {Promise.<Search>}
*/
selectFilter(name: string): Promise<Search>;
/** @type {boolean} */
get has_continuation(): boolean;
/** @type {string[]} */
get filters(): string[];
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get songs(): import("../contents/classes/MusicResponsiveListItem")[];
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get videos(): import("../contents/classes/MusicResponsiveListItem")[];
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get albums(): import("../contents/classes/MusicResponsiveListItem")[];
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get artists(): import("../contents/classes/MusicResponsiveListItem")[];
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get playlists(): import("../contents/classes/MusicResponsiveListItem")[];
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get page(): import("../contents/classes/MusicResponsiveListItem")[];
#private;
}

View File

@@ -27,6 +27,14 @@ export class NoStreamingDataError extends InnertubeError {
* @returns {object|Array.<any>}
*/
export function findNode(obj: object, key: string, target: string, depth: number, safe?: boolean): object | Array<any>;
/**
* Creates a trap to intercept property access
* and add utilities to an object.
*
* @param {*} obj
* @returns
*/
export function observe(obj: any): any;
/**
* Returns a random user agent.
*