ExDisco.Artists (ex_disco v0.1.0)

Copy Markdown View Source

Query artist information from Discogs.

Artists represent individual musicians, groups, or collectives that have released music. Each artist has a unique Discogs ID and can have releases, aliases (alternate names), and related metadata.

Examples

Fetch an artist by ID:

{:ok, artist} = ExDisco.Artists.get(1)
IO.inspect(artist.name)

Fetch releases by an artist:

{:ok, releases} = ExDisco.Artists.get_releases(1)
Enum.each(releases, &IO.inspect(&1.title))

See ExDisco.Artists.Artist for the artist data structure.

Summary

Functions

Fetch a single artist by Discogs ID.

Fetch releases (albums, EPs, singles) by an artist.

Functions

get(id)

@spec get(pos_integer()) ::
  {:ok, ExDisco.Artists.Artist.t()} | {:error, ExDisco.Error.t()}

Fetch a single artist by Discogs ID.

Returns detailed information about the artist including name, profile, images, aliases, and discography links.

Examples

iex> ExDisco.Artists.get(1)
{:ok, %ExDisco.Artists.Artist{id: 1, name: "Arif Mardin", ...}}

iex> ExDisco.Artists.get(9999999)
{:error, %ExDisco.Error{type: :not_found}}

get_releases(id, opts \\ [])

@spec get_releases(
  pos_integer(),
  keyword()
) ::
  {:ok, ExDisco.Page.t(ExDisco.Types.ReleaseSummary.t())}
  | {:error, ExDisco.Error.t()}

Fetch releases (albums, EPs, singles) by an artist.

Returns a paginated list of the artist's releases. Use the opts keyword list to control pagination and sorting.

Options

  • :page — Page number (default: 1)
  • :per_page — Items per page (default: 50)
  • :sort — Sort field: year, title, format
  • :sort_orderasc or desc

Examples

iex> ExDisco.Artists.get_releases(1)
{:ok, %ExDisco.Page{items: [%ExDisco.Types.ReleaseSummary{}, ...], total: 42}}

iex> ExDisco.Artists.get_releases(1, page: 2, per_page: 25, sort: "year")
{:ok, %ExDisco.Page{items: [...], page: 2, pages: 3}}