chore: add proper documentation (#763)

* chore: generate API ref using `typedoc`

* chore: declutter readme and add links to ytjs.dev

* chore: clean up
This commit is contained in:
Luan
2024-09-23 17:32:50 -03:00
committed by GitHub
parent dd7f5cf778
commit 74659fd03f
853 changed files with 139814 additions and 1929 deletions

View File

@@ -0,0 +1,11 @@
[youtubei.js](../../README.md) / Managers
# Managers
## Index
### Classes
- [AccountManager](classes/AccountManager.md)
- [InteractionManager](classes/InteractionManager.md)
- [PlaylistManager](classes/PlaylistManager.md)

View File

@@ -0,0 +1,127 @@
[youtubei.js](../../../README.md) / [Managers](../README.md) / AccountManager
# Class: AccountManager
## Constructors
### new AccountManager()
> **new AccountManager**(`actions`): [`AccountManager`](AccountManager.md)
#### Parameters
**actions**: [`Actions`](../../../classes/Actions.md)
#### Returns
[`AccountManager`](AccountManager.md)
#### Defined in
[src/core/managers/AccountManager.ts:22](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/AccountManager.ts#L22)
## Properties
### channel
> **channel**: `object`
#### editDescription()
> **editDescription**: (`new_description`) => `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
##### Parameters
**new\_description**: `string`
##### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### editName()
> **editName**: (`new_name`) => `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
##### Parameters
**new\_name**: `string`
##### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### getBasicAnalytics()
> **getBasicAnalytics**: () => `Promise`\<[`Analytics`](../../YT/classes/Analytics.md)\>
##### Returns
`Promise`\<[`Analytics`](../../YT/classes/Analytics.md)\>
#### Defined in
[src/core/managers/AccountManager.ts:16](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/AccountManager.ts#L16)
## Methods
### getAnalytics()
> **getAnalytics**(): `Promise`\<[`Analytics`](../../YT/classes/Analytics.md)\>
Retrieves basic channel analytics.
#### Returns
`Promise`\<[`Analytics`](../../YT/classes/Analytics.md)\>
#### Defined in
[src/core/managers/AccountManager.ts:107](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/AccountManager.ts#L107)
***
### getInfo()
> **getInfo**(): `Promise`\<[`AccountInfo`](../../YT/classes/AccountInfo.md)\>
Retrieves channel info.
#### Returns
`Promise`\<[`AccountInfo`](../../YT/classes/AccountInfo.md)\>
#### Defined in
[src/core/managers/AccountManager.ts:66](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/AccountManager.ts#L66)
***
### getSettings()
> **getSettings**(): `Promise`\<[`Settings`](../../YT/classes/Settings.md)\>
Opens YouTube settings.
#### Returns
`Promise`\<[`Settings`](../../YT/classes/Settings.md)\>
#### Defined in
[src/core/managers/AccountManager.ts:95](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/AccountManager.ts#L95)
***
### getTimeWatched()
> **getTimeWatched**(): `Promise`\<[`TimeWatched`](../../YT/classes/TimeWatched.md)\>
Retrieves time watched statistics.
#### Returns
`Promise`\<[`TimeWatched`](../../YT/classes/TimeWatched.md)\>
#### Defined in
[src/core/managers/AccountManager.ts:81](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/AccountManager.ts#L81)

View File

@@ -0,0 +1,232 @@
[youtubei.js](../../../README.md) / [Managers](../README.md) / InteractionManager
# Class: InteractionManager
## Constructors
### new InteractionManager()
> **new InteractionManager**(`actions`): [`InteractionManager`](InteractionManager.md)
#### Parameters
**actions**: [`Actions`](../../../classes/Actions.md)
#### Returns
[`InteractionManager`](InteractionManager.md)
#### Defined in
[src/core/managers/InteractionManager.ts:16](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L16)
## Methods
### comment()
> **comment**(`video_id`, `text`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Posts a comment on a given video.
#### Parameters
**video\_id**: `string`
The video ID
**text**: `string`
The comment text
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Defined in
[src/core/managers/InteractionManager.ts:127](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L127)
***
### dislike()
> **dislike**(`video_id`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Dislikes a given video.
#### Parameters
**video\_id**: `string`
The video ID
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Defined in
[src/core/managers/InteractionManager.ts:44](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L44)
***
### like()
> **like**(`video_id`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Likes a given video.
#### Parameters
**video\_id**: `string`
The video ID
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Defined in
[src/core/managers/InteractionManager.ts:24](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L24)
***
### removeRating()
> **removeRating**(`video_id`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Removes a like/dislike.
#### Parameters
**video\_id**: `string`
The video ID
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Defined in
[src/core/managers/InteractionManager.ts:64](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L64)
***
### setNotificationPreferences()
> **setNotificationPreferences**(`channel_id`, `type`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Changes notification preferences for a given channel.
Only works with channels you are subscribed to.
#### Parameters
**channel\_id**: `string`
The channel ID.
**type**: `"PERSONALIZED"` \| `"ALL"` \| `"NONE"`
The notification type.
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Defined in
[src/core/managers/InteractionManager.ts:188](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L188)
***
### subscribe()
> **subscribe**(`channel_id`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Subscribes to a given channel.
#### Parameters
**channel\_id**: `string`
The channel ID
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Defined in
[src/core/managers/InteractionManager.ts:84](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L84)
***
### translate()
> **translate**(`text`, `target_language`, `args`): `Promise`\<`object`\>
Translates a given text using YouTube's comment translate feature.
#### Parameters
**text**: `string`
**target\_language**: `string`
an ISO language code
**args** = `{}`
optional arguments
**args.comment\_id?**: `string`
**args.video\_id?**: `string`
#### Returns
`Promise`\<`object`\>
##### data
> **data**: [`IRawResponse`](../../APIResponseTypes/interfaces/IRawResponse.md) = `response.data`
##### status\_code
> **status\_code**: `number` = `response.status_code`
##### success
> **success**: `boolean` = `response.success`
##### translated\_content
> **translated\_content**: `any` = `mutation.translatedContent.content`
#### Defined in
[src/core/managers/InteractionManager.ts:160](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L160)
***
### unsubscribe()
> **unsubscribe**(`channel_id`): `Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
Unsubscribes from a given channel.
#### Parameters
**channel\_id**: `string`
The channel ID
#### Returns
`Promise`\<[`ApiResponse`](../../../interfaces/ApiResponse.md)\>
#### Defined in
[src/core/managers/InteractionManager.ts:105](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/InteractionManager.ts#L105)

View File

@@ -0,0 +1,279 @@
[youtubei.js](../../../README.md) / [Managers](../README.md) / PlaylistManager
# Class: PlaylistManager
## Constructors
### new PlaylistManager()
> **new PlaylistManager**(`actions`): [`PlaylistManager`](PlaylistManager.md)
#### Parameters
**actions**: [`Actions`](../../../classes/Actions.md)
#### Returns
[`PlaylistManager`](PlaylistManager.md)
#### Defined in
[src/core/managers/PlaylistManager.ts:14](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L14)
## Methods
### addVideos()
> **addVideos**(`playlist_id`, `video_ids`): `Promise`\<`object`\>
Adds videos to a given playlist.
#### Parameters
**playlist\_id**: `string`
The playlist ID.
**video\_ids**: `string`[]
An array of video IDs to add to the playlist.
#### Returns
`Promise`\<`object`\>
##### action\_result
> **action\_result**: `any`
##### playlist\_id
> **playlist\_id**: `string`
#### Defined in
[src/core/managers/PlaylistManager.ts:73](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L73)
***
### create()
> **create**(`title`, `video_ids`): `Promise`\<`object`\>
Creates a playlist.
#### Parameters
**title**: `string`
The title of the playlist.
**video\_ids**: `string`[]
An array of video IDs to add to the playlist.
#### Returns
`Promise`\<`object`\>
##### data
> **data**: `any`
##### playlist\_id?
> `optional` **playlist\_id**: `string`
##### status\_code
> **status\_code**: `number`
##### success
> **success**: `boolean`
#### Defined in
[src/core/managers/PlaylistManager.ts:23](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L23)
***
### delete()
> **delete**(`playlist_id`): `Promise`\<`object`\>
Deletes a given playlist.
#### Parameters
**playlist\_id**: `string`
The playlist ID.
#### Returns
`Promise`\<`object`\>
##### data
> **data**: `any`
##### playlist\_id
> **playlist\_id**: `string`
##### status\_code
> **status\_code**: `number`
##### success
> **success**: `boolean`
#### Defined in
[src/core/managers/PlaylistManager.ts:48](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L48)
***
### moveVideo()
> **moveVideo**(`playlist_id`, `moved_video_id`, `predecessor_video_id`): `Promise`\<`object`\>
Moves a video to a new position within a given playlist.
#### Parameters
**playlist\_id**: `string`
The playlist ID.
**moved\_video\_id**: `string`
The video ID to move.
**predecessor\_video\_id**: `string`
The video ID to move the moved video before.
#### Returns
`Promise`\<`object`\>
##### action\_result
> **action\_result**: `any`
##### playlist\_id
> **playlist\_id**: `string`
#### Defined in
[src/core/managers/PlaylistManager.ts:156](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L156)
***
### removeVideos()
> **removeVideos**(`playlist_id`, `video_ids`, `use_set_video_ids`): `Promise`\<`object`\>
Removes videos from a given playlist.
#### Parameters
**playlist\_id**: `string`
The playlist ID.
**video\_ids**: `string`[]
An array of video IDs to remove from the playlist.
**use\_set\_video\_ids**: `boolean` = `false`
Option to remove videos using set video IDs.
#### Returns
`Promise`\<`object`\>
##### action\_result
> **action\_result**: `any`
##### playlist\_id
> **playlist\_id**: `string`
#### Defined in
[src/core/managers/PlaylistManager.ts:101](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L101)
***
### setDescription()
> **setDescription**(`playlist_id`, `description`): `Promise`\<`object`\>
Sets the description for the given playlist.
#### Parameters
**playlist\_id**: `string`
The playlist ID.
**description**: `string`
The description to use for the playlist.
#### Returns
`Promise`\<`object`\>
##### action\_result
> **action\_result**: `any`
##### playlist\_id
> **playlist\_id**: `string`
#### Defined in
[src/core/managers/PlaylistManager.ts:239](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L239)
***
### setName()
> **setName**(`playlist_id`, `name`): `Promise`\<`object`\>
Sets the name (title) for the given playlist.
#### Parameters
**playlist\_id**: `string`
The playlist ID.
**name**: `string`
The name / title to use for the playlist.
#### Returns
`Promise`\<`object`\>
##### action\_result
> **action\_result**: `any`
##### playlist\_id
> **playlist\_id**: `string`
#### Defined in
[src/core/managers/PlaylistManager.ts:211](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/core/managers/PlaylistManager.ts#L211)