Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Aug 13, 2023
1 parent 26bd2f9 commit e19efb3
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

<details>
<summary>Example Payload</summary>

```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": {}
}
```

</details>

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 |

0 comments on commit e19efb3

Please sign in to comment.