Current section
Files
Jump to
Current section
Files
lib/crawlberg/downloaded_asset.ex
# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:23d662f17ccee663375ea978facec5b4b691adf30860c73224d58efb602c12d2
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule Crawlberg.DownloadedAsset do
@moduledoc "A downloaded asset from a page."
@typedoc "A downloaded asset from a page."
@type t :: %__MODULE__{
url: String.t() | nil,
content_hash: String.t() | nil,
mime_type: String.t() | nil,
size: non_neg_integer(),
asset_category: String.t() | nil,
html_tag: String.t() | nil
}
defstruct url: nil,
content_hash: nil,
mime_type: nil,
size: 0,
asset_category: :image,
html_tag: nil
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end