From e19efb3cb1abb24370e4c6dd5a79a976e60dc95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Sun, 13 Aug 2023 16:54:59 +0200 Subject: [PATCH] add docs --- README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/README.md b/README.md index ddc1d8a..f10ccf0 100644 --- a/README.md +++ b/README.md @@ -89,3 +89,103 @@ lavalink: ``` Snapshot builds are available in https://maven.topi.wtf/snapshots with the short commit hash as the version + +LavaSearch adds a new endpoint to Lavalink, `GET` `/v4/loadsearch`. This endpoint is used to search for tracks, albums, +artists, playlists & text. + +The endpoint accepts the following query parameters: + +| Parameter | Type | Description | +|-----------|--------|-------------------------------------------------------------------------------------------------| +| query | string | The search query | +| types | string | The types to search for, can be one or more of `track`, `album`, `artist`, `playlist` or `text` | + +The endpoint returns a JSON object with the following structure: + +> [!Note] +> The tracks field of playlists are always empty + +| Field | Type | Description | +|-----------|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------| +| tracks | array of [Track](https://github.com/lavalink-devs/Lavalink/blob/master/IMPLEMENTATION.md#track) objects | An array of tracks, only present if `track` is in `types` | +| albums | array of [Playlist](https://github.com/lavalink-devs/Lavalink/blob/master/IMPLEMENTATION.md#load-result-data---playlist) objects | An array of albums, only present if `album` is in `types` | +| artists | array of [Playlist](https://github.com/lavalink-devs/Lavalink/blob/master/IMPLEMENTATION.md#load-result-data---playlist) objects | An array of artists, only present if `artist` is in `types` | +| playlists | array of [Playlist](https://github.com/lavalink-devs/Lavalink/blob/master/IMPLEMENTATION.md#load-result-data---playlist) objects | An array of playlists, only present if `playlist` is in `types` | +| texts | array of [Text](#text-object) objects | An array of text results, only present if `text` is in `types` | +| plugin | object | Addition result data provided by plugins | + +
+Example Payload + +```json +{ + "tracks": [ + { + "encoded": "QAAB/gMAB0FuaW1hbHMACkFyY2hpdGVjdHMAAAAAAAO5IAAKMTA5MDUzODA4MgABACNodHRwczovL2RlZXplci5jb20vdHJhY2svMTA5MDUzODA4MgEAAAAAAAAAAAA==", + "info": { + "identifier": "1090538082", + "isSeekable": true, + "author": "Architects", + "length": 244000, + "isStream": false, + "position": 0, + "title": "Animals", + "uri": "https://deezer.com/track/1090538082", + "sourceName": "deezer", + "artworkUrl": "https://e-cdns-images.dzcdn.net/images/cover/f63fc26eda9ed39f84c1a533e2716f46/1000x1000-000000-80-0-0.jpg", + "isrc": null + }, + "pluginInfo": {} + } + ], + "albums": [ + { + "info": { + "name": "For Those That Wish To Exist", + "selectedTrack": -1 + }, + "pluginInfo": {}, + "tracks": [] + } + ], + "artists": [ + { + "info": { + "name": "Architects's Top Tracks", + "selectedTrack": -1 + }, + "pluginInfo": {}, + "tracks": [] + } + ], + "playlists": [ + { + "info": { + "name": "100% Architects", + "selectedTrack": -1 + }, + "pluginInfo": {}, + "tracks": [] + } + ], + "texts": [ + { + "text": "Architects", + "plugin": {} + } + ], + "plugin": {} +} +``` + +
+ +If no results are found the endpoint returns a http status code of `404` + +### Text Object + +| Field | Type | Description | +|--------|--------|------------------------------------------| +| text | string | The title of the text result | +| plugin | object | Addition result data provided by plugins | +