Current section

Files

Jump to
crawlberg lib crawlberg crawl_stream_request.ex
Raw

lib/crawlberg/crawl_stream_request.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.CrawlStreamRequest do
@moduledoc """
Request to begin a single-URL streaming crawl.
Wraps a single seed URL for delivery through the streaming-adapter binding
surface. Required as a struct because alef's streaming adapter requires a
named request type — primitives are not supported.
"""
@typedoc "Request to begin a single-URL streaming crawl."
@type t :: %__MODULE__{
url: String.t() | nil
}
defstruct url: 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