Files
Claudio Ortolina 9e1dbfd530 Re-enable Credo ModuleDoc check
Closes #108
2026-03-13 10:52:01 +00:00

22 lines
520 B
Elixir

defmodule LastFm.Scrobble do
@moduledoc false
defstruct [:track, :artist, :timestamp, :album, :album_artist, :mbid]
@type t :: %__MODULE__{
track: String.t(),
artist: String.t(),
timestamp: integer(),
album: String.t() | nil,
album_artist: String.t() | nil,
mbid: String.t() | nil
}
@spec encode(t()) :: map()
def encode(scrobble) do
scrobble
|> Map.from_struct()
|> Map.reject(fn {_key, value} -> is_nil(value) end)
end
end