Enforce keys for all structs
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
defmodule LastFm.Album do
|
defmodule LastFm.Album do
|
||||||
|
@enforce_keys [:musicbrainz_id, :title]
|
||||||
defstruct [:musicbrainz_id, :title]
|
defstruct [:musicbrainz_id, :title]
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
defmodule LastFm.Artist do
|
defmodule LastFm.Artist do
|
||||||
|
@enforce_keys [:musicbrainz_id, :name]
|
||||||
defstruct [:musicbrainz_id, :name, :bio, :image, :play_count]
|
defstruct [:musicbrainz_id, :name, :bio, :image, :play_count]
|
||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ defmodule LastFm.Config do
|
|||||||
user_agent: String.t()
|
user_agent: String.t()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@enforce_keys [:api, :api_key, :user]
|
||||||
defstruct api: LastFm.Api,
|
defstruct api: LastFm.Api,
|
||||||
api_key: "",
|
api_key: "",
|
||||||
user: "",
|
user: "",
|
||||||
|
|||||||
@@ -7,6 +7,15 @@ defmodule LastFm.Track do
|
|||||||
|
|
||||||
alias LastFm.{Album, Artist}
|
alias LastFm.{Album, Artist}
|
||||||
|
|
||||||
|
@enforce_keys [
|
||||||
|
:musicbrainz_id,
|
||||||
|
:title,
|
||||||
|
:artist,
|
||||||
|
:album,
|
||||||
|
:cover_url,
|
||||||
|
:scrobbled_at_uts,
|
||||||
|
:scrobbled_at_label
|
||||||
|
]
|
||||||
defstruct [
|
defstruct [
|
||||||
:musicbrainz_id,
|
:musicbrainz_id,
|
||||||
:title,
|
:title,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ defmodule MusicBrainz.Config do
|
|||||||
user_agent: String.t()
|
user_agent: String.t()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@enforce_keys [:api, :user_agent]
|
||||||
defstruct api: MusicBrainz.APIImpl,
|
defstruct api: MusicBrainz.APIImpl,
|
||||||
user_agent: "change me"
|
user_agent: "change me"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
defmodule MusicBrainz.ReleaseGroup do
|
defmodule MusicBrainz.ReleaseGroup do
|
||||||
|
@enforce_keys [:id, :type, :title, :artists, :release]
|
||||||
defstruct [:id, :type, :title, :artists, :release]
|
defstruct [:id, :type, :title, :artists, :release]
|
||||||
|
|
||||||
def from_api_response(rg) do
|
def from_api_response(rg) do
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
defmodule Obsidian.Entry do
|
defmodule Obsidian.Entry do
|
||||||
|
@enforce_keys [:type, :musicbrainz_id, :title, :release, :cover_url, :genres]
|
||||||
defstruct [:type, :musicbrainz_id, :title, :release, :cover_url, :genres]
|
defstruct [:type, :musicbrainz_id, :title, :release, :cover_url, :genres]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
defmodule OpenAI.Completion do
|
defmodule OpenAI.Completion do
|
||||||
|
@enforce_keys [:content]
|
||||||
defstruct content: "",
|
defstruct content: "",
|
||||||
temperature: 0.2,
|
temperature: 0.2,
|
||||||
role: "user",
|
role: "user",
|
||||||
|
|||||||
Reference in New Issue
Block a user