First pass at uniformed types, specs and docs
- spec public functions (skipping controllers, views, live views and components) - use types instead of explanations in docs - remove redundant docs - fix typos
This commit is contained in:
@@ -4,6 +4,15 @@ defmodule MusicBrainz.ReleaseGroupSearchResult do
|
||||
@enforce_keys [:id, :type, :title, :artists, :release_date]
|
||||
defstruct [:id, :type, :title, :artists, :release_date]
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
id: String.t(),
|
||||
type: :album | :ep | :live | :compilation | :single | :other,
|
||||
title: String.t(),
|
||||
artists: String.t(),
|
||||
release_date: String.t() | nil
|
||||
}
|
||||
|
||||
@spec from_api_response(map()) :: t()
|
||||
def from_api_response(rg) do
|
||||
%__MODULE__{
|
||||
id: rg["id"],
|
||||
@@ -14,6 +23,7 @@ defmodule MusicBrainz.ReleaseGroupSearchResult do
|
||||
}
|
||||
end
|
||||
|
||||
@spec thumb_url(t()) :: String.t()
|
||||
def thumb_url(rgr) do
|
||||
"https://coverartarchive.org/release-group/#{rgr.id}/front-250"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user