diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index fdb81b9..d289823 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -29,6 +29,7 @@ export default defineUserConfig({ } ] } - ] + ], + sidebarDepth: 5 } }) diff --git a/docs/.vuepress/styles/index.scss b/docs/.vuepress/styles/index.scss index 4d4e641..ca46b5c 100644 --- a/docs/.vuepress/styles/index.scss +++ b/docs/.vuepress/styles/index.scss @@ -1,3 +1,15 @@ :root { scroll-behavior: smooth; } + +.code-left { + padding-right: 0; +} + +.code-right { + padding-left: 0; +} + +.anchor { + font-size: 0.85rem; +} \ No newline at end of file diff --git a/docs/docs/references.md b/docs/docs/references.md index 291080e..98923fd 100644 --- a/docs/docs/references.md +++ b/docs/docs/references.md @@ -24,6 +24,109 @@ public async getSearchSuggestions(query: string): Promise ### `search` +::: tip Properties + +| Name | Data Type | Description | +| :------ | :-------- | :----------- | +| `query` | `string` | Search query | + +::: + +::: tip Returns + +Promise< +SearchResult +[]> + +::: + +```ts +public async search(query: string): Promise +``` + +#### `search` for songs + +::: tip Properties + +| Name | Data Type | Description | +| :--------- | :--------- | :----------------------------- | +| `query` | `string` | Search query | +| `category` | `"STRING"` | Category of results to receive | + +::: + +::: tip Returns + +Promise< +SongDetailed +[]> + +::: + +```ts +public async search(query: string, category: "SONG"): Promise +``` + +#### `search` for videos + +::: tip Properties + +| Name | Data Type | Description | +| :--------- | :-------- | :----------------------------- | +| `query` | `string` | Search query | +| `category` | `"VIDEO"` | Category of results to receive | + +::: + +```ts +public async search(query: string, category: "VIDEO"): Promise +``` + +#### `search` for artists + +::: tip Properties + +| Name | Data Type | Description | +| :--------- | :--------- | :----------------------------- | +| `query` | `string` | Search query | +| `category` | `"ARTIST"` | Category of results to receive | + +::: + +```ts +public async search(query: string, category: "ARTIST"): Promise +``` + +#### `search` for albums + +::: tip Properties + +| Name | Data Type | Description | +| :--------- | :-------- | :----------------------------- | +| `query` | `string` | Search query | +| `category` | `"ALBUM"` | Category of results to receive | + +::: + +```ts +public async search(query: string, category: "ALBUM"): Promise +``` + +#### `search` for playlists + +::: tip Properties + +| Name | Data Type | Description | +| :--------- | :----------- | :----------------------------- | +| `query` | `string` | Search query | +| `category` | `"PLAYLIST"` | Category of results to receive | + +::: + +```ts +public async search(query: string, category: "PLAYLIST"): Promise +``` + ### `getSong` ### `getVideo` diff --git a/docs/docs/usage.md b/docs/docs/usage.md index 07808b7..53331f6 100644 --- a/docs/docs/usage.md +++ b/docs/docs/usage.md @@ -32,6 +32,87 @@ ytmusic.getSearchSuggestions("Lilac").then(res => { ## `search` function +`search()` will fetch search results from YouTube Music directly based on the query and result type provided + +### `search` for songs +### `search` for videos +### `search` for artists +### `search` for albums +### `search` for playlists + + +This function takes in the following parameters + + + +The function **when nothing is passed as the category** returns a `Promise<`[SearchResult](#SearchResult)`[]>` which are the search results of all categories + +```ts +ytmusic.search("Lilac").then(results => { + console.log(results) +}) +``` + +##### `search (category = "SONG")` + +When you pass in `"SONG"` as the category, + +The function returns a `Promise<`[SongDetailed](#SongDetailed)`[]>` which are the song results + +```ts +ytmusic.search("Lilac", "SONG").then(songs => { + console.log(songs) +}) +``` + +##### `search (category = "VIDEO")` + +When you pass in `"VIDEO"` as the category, + +The function returns a `Promise<`[VideoDetailed](#VideoDetailed)`[]>` which are the video results + +```ts +ytmusic.search("Lilac", "VIDEO").then(videos => { + console.log(videos) +}) +``` + +##### `search (category = "ARTIST")` + +When you pass in `"ARTIST"` as the category + +The function returns a `Promise<`[ArtistDetailed](#ArtistDetailed)`[]>` which are the artist results + +```ts +ytmusic.search("Lilac", "ARTIST").then(artists => { + console.log(artists) +}) +``` + +##### `search (category = "ALBUM")` + +When you pass in `"ALBUM"` as the category, + +The function returns a `Promise<`[AlbumDetailed](#AlbumDetailed)`[]>` which are the album results + +```ts +ytmusic.search("Lilac", "ALBUM").then(albums => { + console.log(albums) +}) +``` + +##### `search (category = "PLAYLIST")` + +When you pass in `"PLAYLIST"` as the category, + +The function returns a `Promise<`[PlaylistFull](#PlaylistFull)`[]>` which are the playlist results + +```ts +ytmusic.search("Lilac", "PLAYLIST").then(playlists => { + console.log(playlists) +}) +``` + ## `getSong` function ## `getVideo` function