# Spotify

### Classes

[Spotify](#Spotify)

### Functions

[setProgressBar(type, color)](#setProgressBar) ⇒ [`Spotify`](#Spotify)

Set progress bar details

[setTitle(title)](#setTitle) ⇒ [`Spotify`](#Spotify)

Set title

[setImage(source)](#setImage) ⇒ [`Spotify`](#Spotify)

Establecer imagen

[setAuthor(name)](#setAuthor) ⇒ [`Spotify`](#Spotify)

Set the name of the artist

[setAlbum(name)](#setAlbum) ⇒ [`Spotify`](#Spotify)

Set the name of the album

[setStartTimestamp(time)](#setStartTimestamp) ⇒ [`Spotify`](#Spotify)

Set start timestamp

[setEndTimestamp(time)](#setEndTimestamp) ⇒ [`Spotify`](#Spotify)

Set end timestamp

[setBackground(type, data)](#setBackground) ⇒ [`Spotify`](#Spotify)

Set background image/color of the card

[build(\[font\])](#build) ⇒ `Promise.<Buffer>`

Build the Spotify presence card

### Spotify

**Kind**: global class<br>

#### new Spotify()

Spotify card creator

<details>

<summary>PREVIEW</summary>

\
![Spotify Card Preview](https://raw.githubusercontent.com/SrGobi/canvacard/refs/heads/test/spotify.png)

</details>

**Example**

```js
const spotify = new canvacard.Spotify()
  .setAuthor("SAIKO")
  .setAlbum("SAKURA 👋")
  .setStartTimestamp(Date.now() - 10000)
  .setEndTimestamp(Date.now() + 50000)
  .setImage("https://i.scdn.co/image/ab67616d00001e02e346fc6f767ca2ac8365fe60")
  .setTitle("YO LO SOÑÉ");
const spotifyImage = await spotify.build("Cascadia Code PL");
canvacard.write(spotifyImage, "./spotify.png");
```

### setProgressBar(type, color) ⇒ [`Spotify`](#Spotify)

Set progress bar details

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Invalid progress bar type

| Param | Type                 | Description               |
| ----- | -------------------- | ------------------------- |
| type  | `"TRACK"` \| `"BAR"` | Type of progress bar      |
| color | `string`             | Color of the progress bar |

### setTitle(title) ⇒ [`Spotify`](#Spotify)

Set title

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Title expected but not received

| Param | Type     | Description       |
| ----- | -------- | ----------------- |
| title | `string` | Title of the song |

### setImage(source) ⇒ [`Spotify`](#Spotify)

Establecer imagen

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Image source expected but not received

| Param  | Type                                   | Description      |
| ------ | -------------------------------------- | ---------------- |
| source | `string` \| `Buffer` \| `Canvas.Image` | Fuente de imagen |

### setAuthor(name) ⇒ [`Spotify`](#Spotify)

Set the name of the artist

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Artist name expected but not received

| Param | Type     | Description        |
| ----- | -------- | ------------------ |
| name  | `string` | Name of the artist |

### setAlbum(name) ⇒ [`Spotify`](#Spotify)

Set the name of the album

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Album name expected but not received

| Param | Type     | Description       |
| ----- | -------- | ----------------- |
| name  | `string` | Name of the album |

### setStartTimestamp(time) ⇒ [`Spotify`](#Spotify)

Set start timestamp

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Timestamp expected but not received

| Param | Type               | Description |
| ----- | ------------------ | ----------- |
| time  | `Date` \| `number` | Timestamp   |

### setEndTimestamp(time) ⇒ [`Spotify`](#Spotify)

Set end timestamp

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Timestamp expected but not received

| Param | Type               | Description |
| ----- | ------------------ | ----------- |
| time  | `Date` \| `number` | Timestamp   |

### setBackground(type, data) ⇒ [`Spotify`](#Spotify)

Set background image/color of the card

**Kind**: global function\
**Returns**: [`Spotify`](#Spotify) - The current instance of Spotify\
**Throws**:

* `APIError` Missing background data

| Param | Type                                   | Description                  |
| ----- | -------------------------------------- | ---------------------------- |
| type  | `"COLOR"` \| `"IMAGE"`                 | Type of background           |
| data  | `string` \| `Buffer` \| `Canvas.Image` | Image URL or HTML color code |

### build(\[font]) ⇒ `Promise.<Buffer>`

Build the Spotify presence card

**Kind**: global function\
**Returns**: `Promise.<Buffer>` - Card image in buffer format\
**Throws**:

* `APIError` Missing of options

| Param   | Type     | Default               | Description             |
| ------- | -------- | --------------------- | ----------------------- |
| \[font] | `string` | `"&quot;Arial&quot;"` | Font to use in the card |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://canvacard.srgobi.com/classes/spotify.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
