# `Infusion`
[🔗](https://github.com/mandar1045/infusion/blob/v0.1.0/lib/infusion.ex#L1)

Generates Elixir SDKs from OpenAPI specs.

    {:ok, result} = Infusion.generate("openapi.yaml", name: "OpenAI")
    result.files     #=> [%{path: "lib/openai/models.ex", source: "..."}, ...]
    result.warnings  #=> what the spec does that the SDK can't represent

Or from the command line, `mix infusion.gen`. See the
[design](docs/design.md) for how specs become SDKs.

# `generate`

```elixir
@spec generate(String.t(), keyword()) ::
  {:ok,
   %{
     files: [Infusion.Gen.Schemas.file()],
     warnings: [String.t()],
     ir: %Infusion.IR{
       auth: term(),
       operations: term(),
       schemas: term(),
       servers: term(),
       warnings: term()
     }
   }}
  | {:error, String.t()}
```

Generates the files of an SDK from `source` (a path or URL).

Options: `:name` (the base module, required), plus those of
`Infusion.Gen.Project.render/4` and `Infusion.Spec.load/2`.

# `write`

```elixir
@spec write([Infusion.Gen.Schemas.file()], Path.t()) :: :ok
```

Writes generated `files` under `dir`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
