Wrote documentation for all references

This commit is contained in:
Zechariah 2022-03-30 15:15:44 +08:00
parent 9c236bc4f8
commit e192392ce2
13 changed files with 374 additions and 152 deletions

142
README.md
View File

@ -226,148 +226,6 @@ ytmusic.getPlaylistVideos("OLAK5uy_nRb467jR73IXKybwzw22_rTYIJ808x4Yc").then(play
})
```
### Data Types
#### `ThumbnailFull`
| Name | Data Type | Description |
| :----- | :-------- | :------------------ |
| url | `string` | Link |
| width | `number` | Width of the image |
| height | `number` | Height of the image |
#### `SongDetailed`
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :------------------ |
| type | `"SONG"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](#ArtistBasic)`[]` | Artists |
| album | [AlbumBasic](#AlbumBasic) | Album |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
#### `SongFull`
| Name | Data Type | Description |
| :-------------- | :---------------------------------- | :--------------------- |
| type | `"SONG"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](#ArtistBasic)`[]` | Artists |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
| description | `string` | Description |
| formats | `any[]` | Video Formats |
| adaptiveFormats | `any[]` | Adaptive Video Formats |
#### `VideoDetailed`
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :------------------------------ |
| type | `"VIDEO"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](#ArtistBasic)`[]` | Channels that created the video |
| views | `number` | View count |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
#### `VideoFull`
| Name | Data Type | Description |
| :---------- | :---------------------------------- | :------------------------------------- |
| type | `"VIDEO"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](#ArtistBasic)`[]` | Channels that created the video |
| views | `number` | View count |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
| description | `string` | Description |
| unlisted | `boolean` | If the video is unlisted on YouTube |
| familySafe | `boolean` | If the video is family safe on YouTube |
| paid | `boolean` | If the video is paid on YouTube |
| tags | `string[]` | Tags |
#### `ArtistBasic`
| Name | Data Type | Description |
| :------- | :-------- | :---------- |
| artistId | `string` | Artist ID |
| name | `string` | Name |
#### `ArtistDetailed`
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :----------- |
| type | `"ARTIST"` | Type of data |
| artistId | `string` | Artist ID |
| name | `string` | Name |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
#### `ArtistFull`
| Name | Data Type | Description |
| :---------- | :---------------------------------------------------- | :----------------------------------- |
| type | `"ARTIST"` | Type of data |
| artistId | `string` | Artist ID |
| name | `string` | Name |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
| description | `string` | Description |
| subscribers | `number` | Number of subscribers the Artist has |
| topSongs | `Omit<`[SongDetailed](#SongDetailed)`, "duration">[]` | Top Songs from Artist |
| topAlbums | [AlbumDetailed](#AlbumDetailed)`[]` | Top Albums from Artist |
#### `AlbumBasic`
| Name | Data Type | Description |
| :------ | :-------- | :---------- |
| albumId | `string` | Album ID |
| name | `string` | Name |
#### `AlbumDetailed`
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :-------------------- |
| type | `"ALBUM"` | Type of data |
| albumId | `string` | Album ID |
| playlistId | `string` | Playlist ID for Album |
| name | `string` | Name |
| artists | [ArtistBasic](#ArtistBasic)`[]` | Creators of the Album |
| year | `number` | Publication Year |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
#### `AlbumFull`
| Name | Data Type | Description |
| :---------- | :---------------------------------- | :-------------------- |
| type | `"ALBUM"` | Type of data |
| albumId | `string` | Album ID |
| playlistId | `string` | Playlist ID for Album |
| name | `string` | Name |
| artists | [ArtistBasic](#ArtistBasic)`[]` | Creators of the Album |
| year | `number` | Publication Year |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
| description | `string` | Description |
| songs | [SongDetailed](#SongDetailed)`[]` | Songs in the Album |
#### `PlaylistFull`
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :------------------------------- |
| type | `"PLAYLIST"` | Type of data |
| playlistId | `string` | Playlist ID |
| name | `string` | Name |
| artist | [ArtistBasic](#ArtistBasic) | Creator of the Playlist |
| videoCount | `number` | Number of videos in the Playlist |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
#### `SearchResult`
[SongDetailed](#SongDetailed) or [VideoDetailed](#VideoDetailed) or [ArtistDetailed](#ArtistDetailed) or [AlbumDetailed](#AlbumDetailed) or [PlaylistFull](#PlaylistFull)
## Credits
A lot of the credit should go to [youtube-music-api](https://npmjs.com/package/youtube-music-api). I build this package as a refactored and tested version of youtube-music-api with TypeScript annotations

View File

@ -3,19 +3,19 @@
## Properties
| Name | Data Type | Description |
| :----------- | :----------------------------------- | :-------------------- |
| :----------- | :---------------------------------------- | :-------------------- |
| `type` | `"ALBUM"` | Type of data |
| `albumId` | `string` | Album ID |
| `playlistId` | `string` | Playlist ID for Album |
| `name` | `string` | Name |
| `artists` | [ArtistBasic](./ArtistBasic)`[]` | Creators of the Album |
| `artists` | [ArtistBasic](./ArtistBasic.html)`[]` | Creators of the Album |
| `year` | `number` | Publication Year |
| `thumbnails` | [ThumbnailFull](./ThumbnailFull)`[]` | Thumbnails |
| `thumbnails` | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface AlbumBasic {
interface AlbumDetailed {
type: "ALBUM"
albumId: string
playlistId: string
@ -25,3 +25,9 @@ interface AlbumBasic {
thumbnails: ThumbnailFull[]
}
```
## Usages
[ArtistFull#topAlbums](./ArtistFull.html)
[SearchResult](../types/SearchResult.html)

View File

@ -0,0 +1,35 @@
# AlbumFull
## Properties
| Name | Data Type | Description |
| :------------ | :---------------------------------------- | :-------------------- |
| `type` | `"ALBUM"` | Type of data |
| `albumId` | `string` | Album ID |
| `playlistId` | `string` | Playlist ID for Album |
| `name` | `string` | Name |
| `artists` | [ArtistBasic](./ArtistBasic.html)`[]` | Creators of the Album |
| `year` | `number` | Publication Year |
| `thumbnails` | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| `description` | `string` | Description |
| `songs` | [SongDetailed](./SongDetailed.html)`[]` | Songs in the Album |
## TypeScript Source Code
```ts
interface AlbumFull {
type: "ALBUM"
albumId: string
playlistId: string
name: string
artists: ArtistBasic[]
year: number
thumbnails: ThumbnailFull[]
description: string
songs: SongDetailed[]
}
```
## Usages
[YTMusic#getAlbum](../../guides/usage/getAlbum.md)

View File

@ -0,0 +1,27 @@
# ArtistBasic
## Properties
| Name | Data Type | Description |
| :------- | :-------- | :---------- |
| artistId | `string` | Artist ID |
| name | `string` | Name |
## TypeScript Source Code
```ts
interface ArtistBasic {
artistId: string
name: string
}
```
## Usages
[SongDetailed#artists](./SongDetailed.html)
[VideoDetailed#artists](./VideoDetailed.html)
[AlbumDetailed#artists](./AlbumDetailed.html)
[PlaylistFull#artists](./PlaylistFull.html)

View File

@ -0,0 +1,27 @@
# ArtistDetailed
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------------- | :----------- |
| type | `"ARTIST"` | Type of data |
| artistId | `string` | Artist ID |
| name | `string` | Name |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface ArtistDetailed {
type: "ARTIST"
artistId: string
name: string
thumbnails: ThumbnailFull[]
}
```
## Usages
[SearchResult](../types/SearchResult.html)
[YTMusic#searchArtist](../../guides/usage/searchArtist.html)

View File

@ -0,0 +1,33 @@
# ArtistFull
## Properties
| Name | Data Type | Description |
| :---------- | :---------------------------------------------------------- | :----------------------------------- |
| type | `"ARTIST"` | Type of data |
| artistId | `string` | Artist ID |
| name | `string` | Name |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| description | `string` | Description |
| subscribers | `number` | Number of subscribers the Artist has |
| topSongs | `Omit<`[SongDetailed](./SongDetailed.html)`, "duration">[]` | Top Songs from Artist |
| topAlbums | [AlbumDetailed](./AlbumDetailed.html)`[]` | Top Albums from Artist |
## TypeScript Source Code
```ts
interface ArtistFull {
type: "ARTIST"
artistId: string
name: string
thumbnails: ThumbnailFull[]
description: string
subscribers: number
topSongs: Omit<SongDetailed, "duration">[]
topAlbums: AlbumDetailed[]
}
```
## Usages
[YTMusic#getArtist](../../guides/usage/getArtist.html)

View File

@ -0,0 +1,33 @@
# PlaylistFull
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :------------------------------- |
| type | `"PLAYLIST"` | Type of data |
| playlistId | `string` | Playlist ID |
| name | `string` | Name |
| artist | [ArtistBasic](#ArtistBasic) | Creator of the Playlist |
| videoCount | `number` | Number of videos in the Playlist |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface PlaylistFull {
type: "PLAYLIST"
playlistId: string
name: string
artist: ArtistBasic
videoCount: number
thumbnails: ThumbnailFull[]
}
```
## Usages
[SearchResult](../types/SearchResult.html)
[YTMusic#searchPlaylist](../../guides/usage/searchPlaylist.html)
[YTMusic#getPlaylist](../../guides/usage/getPlaylist.html)

View File

@ -0,0 +1,35 @@
# SongDetailed
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------------- | :------------------ |
| type | `"SONG"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Artists |
| album | [AlbumBasic](./AlbumBasic.html) | Album |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface SongDetailed {
type: "SONG"
videoId: string
name: string
artists: ArtistBasic[]
album: AlbumBasic
duration: number
thumbnails: ThumbnailFull[]
}
```
## Usages
[ArtistFull#topSongs](./ArtistFull.html)
[AlbumFull#songs](./AlbumFull.html)
[SearchResult](../types/SearchResult.html)

View File

@ -0,0 +1,35 @@
# SongFull
## Properties
| Name | Data Type | Description |
| :-------------- | :---------------------------------------- | :--------------------- |
| type | `"SONG"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Artists |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| description | `string` | Description |
| formats | `any[]` | Video Formats |
| adaptiveFormats | `any[]` | Adaptive Video Formats |
## TypeScript Source Code
```ts
interface SongFull {
type: "SONG"
videoId: string
name: string
artists: ArtistBasic[]
duration: number
thumbnails: ThumbnailFull[]
description: string
formats: any[]
adaptiveFormats: any[]
}
```
## Usages
[YTMusic#getSong](../../guides/usage/getSong.html)

View File

@ -0,0 +1,31 @@
# ThumbnailFull
## Properties
| Name | Data Type | Description |
| :------- | :-------- | :------------------ |
| `url` | `string` | Link |
| `width` | `number` | Width of the image |
| `height` | `number` | Height of the image |
## TypeScript Source Code
```ts
interface ThumbnailFull {
url: string
width: number
height: number
}
```
## Usages
[SongDetailed#thumbnails](./SongDetailed.html)
[VideoDetailed#thumbnails](./VideoDetailed.html)
[ArtistDetailed#thumbnails](./ArtistDetailed.html)
[AlbumDetailed#thumbnails](./AlbumDetailed.html)
[PlaylistFull#thumbnails](./PlaylistFull.html)

View File

@ -0,0 +1,35 @@
# VideoDetailed
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------------- | :------------------------------ |
| type | `"VIDEO"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Channels that created the video |
| views | `number` | View count |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface VideoDetailed {
type: "VIDEO"
videoId: string
name: string
artists: ArtistBasic[]
views: number
duration: number
thumbnails: ThumbnailFull[]
}
```
## Usages
[SearchResult](../types/SearchResult.html)
[YTMusic#searchVideo](../../guides/usage/searchVideo.html)
[YTMusic#getPlaylistVideos](../../guides/usage/getPlaylistVideos.html)

View File

@ -0,0 +1,41 @@
# VideoFull
## Properties
| Name | Data Type | Description |
| :---------- | :---------------------------------------- | :------------------------------------- |
| type | `"VIDEO"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Channels that created the video |
| views | `number` | View count |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| description | `string` | Description |
| unlisted | `boolean` | If the video is unlisted on YouTube |
| familySafe | `boolean` | If the video is family safe on YouTube |
| paid | `boolean` | If the video is paid on YouTube |
| tags | `string[]` | Tags |
## TypeScript Source Code
```ts
interface VideoFull {
type: "VIDEO"
videoId: string
name: string
artists: ArtistBasic[]
views: number
duration: number
thumbnails: ThumbnailFull[]
description: string
unlisted: boolean
familySafe: boolean
paid: boolean
tags: string[]
}
```
## Usages
[YTMusic#getVideo](../../guides/usage/getVideo.html)

View File

@ -0,0 +1,26 @@
# SearchResult
## Value
Either
- [SongDetailed](../interfaces/SongDetailed.html)
- [VideoDetailed](../interfaces/VideoDetailed.html)
- [AlbumDetailed](../interfaces/AlbumDetailed.html)
- [ArtistDetailed](../interfaces/ArtistDetailed.html)
- [PlaylistFull](../interfaces/PlaylistFull.html)
## TypeScript Source Code
```ts
type SearchResult =
| SongDetailed
| VideoDetailed
| AlbumDetailed
| ArtistDetailed
| PlaylistFull
```
## Usages
[YTMusic#search](../../guides/usage/search.html)