defmodule Spidra do @moduledoc """ The official Elixir SDK for the Spidra API. ## Getting Started You can use the API by passing a `Spidra.Config` struct to the various modules: config = Spidra.Config.new(api_key: "spd_YOUR_API_KEY") {:ok, job} = Spidra.Scrape.run(config, %{ urls: [%{url: "https://news.ycombinator.com"}], prompt: "List the top 5 stories", output: "json" }) """ alias Spidra.Config @doc """ Shorthand to create a new Spidra configuration. This is equivalent to calling `Spidra.Config.new/1`. ## Options * `:api_key` - (Required unless set in ENV) Your Spidra API key starting with `spd_`. * `:base_url` - (Optional) Custom base URL, defaults to `https://api.spidra.io/api`. ## Examples iex> config = Spidra.new(api_key: "spd_YOUR_API_KEY") %Spidra.Config{api_key: "spd_YOUR_API_KEY", base_url: "https://api.spidra.io/api"} iex> config = Spidra.new(api_key: "spd_YOUR_API_KEY", base_url: "http://localhost:4000") %Spidra.Config{api_key: "spd_YOUR_API_KEY", base_url: "http://localhost:4000"} """ @spec new(Keyword.t()) :: Spidra.Config.t() def new(opts \\ []) do Config.new(opts) end end