---
layout: "layouts/DocLayout.astro"
title: Plugin Models
description: "Different types of objects used in Spotube."
order: 0
---

## Image

Following is the structure of the `SpotubeImageObject`:

| Property | Type            |
| -------- | --------------- |
| width    | `int` or `null` |
| height   | `int` or `null` |
| url      | `string`        |

## User

Structure of the `SpotubeUserObject`, which is used to represent a user in Spotube returned by Spotube Plugins.

| Property    | Type                                               |
| ----------- | -------------------------------------------------- |
| id          | `string`                                           |
| name        | `string`                                           |
| externalUri | `string`                                           |
| images      | List of [`SpotubeImageObject`][SpotubeImageObject] |

> `externalUri` is a URL that points to the user's profile on the external service (e.g. Listenbrainz)

## Artist

### SpotubeSimpleArtistObject

Following is the structure of the `SpotubeArtistObject`:

| Property    | Type                                                         |
| ----------- | ------------------------------------------------------------ |
| id          | `string`                                                     |
| name        | `string`                                                     |
| externalUri | `string`                                                     |
| images      | List of [`SpotubeImageObject`][SpotubeImageObject] or `null` |

### SpotubeFullArtistObject

Following is the structure of the `SpotubeFullArtistObject`:

| Property    | Type                                                  |
| ----------- | ----------------------------------------------------- |
| id          | `string`                                              |
| name        | `string`                                              |
| externalUri | `string`                                              |
| images      | List of [`SpotubeImageObject`][SpotubeImageObject] or |
| followers   | `number`                                              |
| genres      | List of `string` or `null`                            |

## Album

### SpotubeSimpleAlbumObject

Following is the structure of the `SpotubeAlbumObject`:

| Property    | Type                                                             |
| ----------- | ---------------------------------------------------------------- |
| id          | `string`                                                         |
| name        | `string`                                                         |
| externalUri | `string`                                                         |
| images      | List of [`SpotubeImageObject`][SpotubeImageObject]               |
| albumType   | `album`, `single` or `compilation`                               |
| artists     | List of [`SpotubeSimpleArtistObject`][SpotubeSimpleArtistObject] |
| releaseDate | `string` (YYYY-MM-DD format) or `null`                           |

### SpotubeFullAlbumObject

Following is the structure of the `SpotubeFullAlbumObject`:

| Property    | Type                                                             |
| ----------- | ---------------------------------------------------------------- |
| id          | `string`                                                         |
| name        | `string`                                                         |
| externalUri | `string`                                                         |
| images      | List of [`SpotubeImageObject`][SpotubeImageObject]               |
| albumType   | `album`, `single` or `compilation`                               |
| artists     | List of [`SpotubeSimpleArtistObject`][SpotubeSimpleArtistObject] |
| releaseDate | `string` (YYYY-MM-DD format)                                     |
| totalTracks | `number`                                                         |
| recordLabel | `string` or `null`                                               |

## Track

Following is the structure of the `SpotubeFullTrackObject`:

| Property                     | Type                                                             |
| ---------------------------- | ---------------------------------------------------------------- |
| id                           | `string`                                                         |
| name                         | `string`                                                         |
| externalUri                  | `string`                                                         |
| artists                      | List of [`SpotubeSimpleArtistObject`][SpotubeSimpleArtistObject] |
| album                        | [`SpotubeSimpleAlbumObject`][SpotubeSimpleAlbumObject]           |
| durationMs (in milliseconds) | `number`                                                         |
| explicit                     | `boolean`                                                        |
| [isrc][isrc_wiki]            | `string`                                                         |

> `isrc` stands for International Standard Recording Code, which is a unique identifier for tracks.
> It is used to identify recordings and is often used in music distribution and royalty collection. The format is typically a 12-character alphanumeric code.

## Playlist

### SpotubeSimplePlaylistObject

Following is the structure of the `SpotubeSimplePlaylistObject`:

| Property    | Type                                                         |
| ----------- | ------------------------------------------------------------ |
| id          | `string`                                                     |
| name        | `string`                                                     |
| description | `string`                                                     |
| externalUri | `string`                                                     |
| images      | List of [`SpotubeImageObject`][SpotubeImageObject] or `null` |
| owner       | [`SpotubeUserObject`][SpotubeUserObject]                     |

### SpotubeFullPlaylistObject

Following is the structure of the `SpotubeFullPlaylistObject`:

| Property      | Type                                                         |
| ------------- | ------------------------------------------------------------ |
| id            | `string`                                                     |
| name          | `string`                                                     |
| description   | `string`                                                     |
| externalUri   | `string`                                                     |
| images        | List of [`SpotubeImageObject`][SpotubeImageObject] or `null` |
| owner         | [`SpotubeUserObject`][SpotubeUserObject]                     |
| collaborators | List of [`SpotubeUserObject`][SpotubeUserObject] or `null`   |
| collaborative | `boolean`                                                    |
| public        | `boolean`                                                    |

## Search Response

Following is the structure of the `SpotubeSearchResponseObject`:

| Property  | Type                                                                 |
| --------- | -------------------------------------------------------------------- |
| albums    | List of [`SpotubeSimpleAlbumObject`][SpotubeSimpleAlbumObject]       |
| artists   | List of [`SpotubeFullArtistObject`][SpotubeFullArtistObject]         |
| playlists | List of [`SpotubeSimplePlaylistObject`][SpotubeSimplePlaylistObject] |
| tracks    | List of [`SpotubeFullTrackObject`][SpotubeFullTrackObject]           |

## Browse Section

Following is the structure of `SpotubeBrowseSectionObject`:

| Property    | Type             |
| ----------- | ---------------- |
| id          | `string`         |
| title       | `string`         |
| externalUri | `string`         |
| browseMore  | `boolean`        |
| items       | List of `Object` |

The `items` property array can contain multiple type of `Object` in it but it will always be

- [`SpotubeFullPlaylistObject`][SpotubeFullPlaylistObject]
- [`SpotubeFullAlbumObject`][SpotubeFullAlbumObject]
- [`SpotubeFullArtistObject`][SpotubeFullArtistObject]

## Pagination Response

`SpotubePaginationResponseObject` is generic model. The `items` property can contain any type of `Object` in it.

This is the structure of `SpotubePaginationResponseObject`:

| Property   | Type                                            |
| ---------- | ----------------------------------------------- |
| limit      | `number`                                        |
| nextOffset | `number` or `null`                              |
| total      | `number`                                        |
| hasMore    | `boolean`                                       |
| items      | List of generic type `T` which extends `Object` |

[isrc_wiki]: https://en.wikipedia.org/wiki/International_Standard_Recording_Code
[SpotubeImageObject]: /docs/reference/models#image
[SpotubeSimpleArtistObject]: /docs/reference/models#spotubesimpleartistobject
[SpotubeSimpleAlbumObject]: /docs/reference/models#spotubesimplealbumobject
[SpotubeUserObject]: /docs/reference/models#user
[SpotubeFullArtistObject]: /docs/reference/models#spotubefullartistobject
[SpotubeSimplePlaylistObject]: /docs/reference/models#spotubesimpleplaylistobject
[SpotubeFullTrackObject]: /docs/reference/models#track
[SpotubeFullPlaylistObject]: /docs/reference/models#spotubefullplaylistobject
[SpotubeFullAlbumObject]: /docs/reference/models#spotubefullalbumobject
