Exspotify.Client (Exspotify v0.1.0)

View Source

HTTP client for interacting with the Spotify Web API.

This module is responsible for making authenticated requests to the Spotify API, handling JSON encoding/decoding, and structured error handling. It expects a valid access token to be provided for each request.

Debug Logging

Enable debug logging to see API requests and responses:

config :exspotify, debug: true

This will log all HTTP requests made to the Spotify API for troubleshooting.

Summary

Functions

Makes a DELETE request to the given Spotify API path with a body, optional headers, and access token.

Makes a GET request to the given Spotify API path with optional headers and access token.

Makes a POST request to the given Spotify API path with a body, optional headers, and access token.

Makes a PUT request to the given Spotify API path with a body, optional headers, and access token.

Functions

delete(path, body, headers \\ [], token)

@spec delete(String.t(), any(), list(), String.t()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Makes a DELETE request to the given Spotify API path with a body, optional headers, and access token.

get(path, headers \\ [], token)

@spec get(String.t(), list(), String.t()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Makes a GET request to the given Spotify API path with optional headers and access token.

post(path, body, headers \\ [], token)

@spec post(String.t(), any(), list(), String.t()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Makes a POST request to the given Spotify API path with a body, optional headers, and access token.

put(path, body, headers \\ [], token)

@spec put(String.t(), any(), list(), String.t()) ::
  {:ok, any()} | {:error, Exspotify.Error.t()}

Makes a PUT request to the given Spotify API path with a body, optional headers, and access token.