ExDisco.Labels (ex_disco v0.1.0)

Copy Markdown View Source

Query label (record company) information from Discogs.

Labels are record companies, publishers, or other entities that release music. Labels can be major corporations or independent publishers. Each label has metadata including contact information, sublabels, and a discography.

Examples

Fetch a record label:

{:ok, label} = ExDisco.Labels.get(1)
IO.inspect(label.name)

Fetch releases from a label:

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

See ExDisco.Labels.Label for the label data structure.

Summary

Functions

Fetch a label by Discogs ID.

Fetch releases published by a label.

Functions

get(id)

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

Fetch a label by Discogs ID.

Returns label information including name, profile, images, contact info, parent label (if any), and sublabels.

Examples

iex> ExDisco.Labels.get(1)
{:ok, %ExDisco.Labels.Label{id: 1, name: "...", ...}}

iex> ExDisco.Labels.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 published by a label.

Returns a paginated list of releases from the label. Use the opts keyword list to control pagination.

Options

  • :page — Page number (default: 1)
  • :per_page — Items per page (default: 50)

Examples

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

iex> ExDisco.Labels.get_releases(1, page: 2, per_page: 25)
{:ok, %ExDisco.Page{items: [...], page: 2}}