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

Turns OpenAPI names into Elixir module and function names.

Each operation gets a module path (`["Repos"]`, `["ZeroTrust", "Devices"]`)
and a function name, from the first strategy that applies:

  1. **Vendor SDK hints**: `x-fern-sdk-group-name` (dot-separated groups)
     and `x-fern-sdk-method-name`. Cloudflare sets them on nearly every
     operation, so its SDK matches the official ones.
  2. **`group/action` operation IDs**, as GitHub uses (`repos/get`).
  3. **The path**, when the operation has no tag (all of Stripe, part of
     OpenAI): `GET /v1/customers` is `Customers.list`, `POST
     /v1/customers/{id}` is `Customers.update`, `POST
     /v1/payment_intents/{id}/cancel` is `PaymentIntents.cancel`, and
     `/v1/customers/{id}/sources` is a nested `Customers.Sources`.
  4. **The tag and the operation ID**, with version prefixes taken off the
     tag (Twilio's `Api20100401Recording`) and the module's words taken off
     the function (`list_recording` in `Recording` is `list`).

# `operation_name`

```elixir
@type operation_name() :: %{
  module: [String.t()],
  function: String.t(),
  strategy: atom()
}
```

# `function_name`

```elixir
@spec function_name(String.t()) :: String.t()
```

A function or field name: `"createChatCompletion"`, `"repos/get-pages"` -> snake_case.

# `module_part`

```elixir
@spec module_part(String.t()) :: String.t()
```

A module name part: `"vector stores"`, `"vector_stores"`, `"vector-stores"` -> `"VectorStores"`.

# `operation`

```elixir
@spec operation(map(), String.t(), String.t()) :: operation_name()
```

Names an operation. `op` is the operation object, `path` and `method` its location.

# `package`

```elixir
@spec package(String.t()) :: String.t()
```

The package name for a base module, as the vendor writes it: `OpenAI` is
`openai`, `GitHub` is `github` (not `open_ai`, `git_hub`). Used for the
app, the directory and the API key's environment variable.

# `words`

```elixir
@spec words(String.t()) :: [String.t()]
```

Splits camelCase, PascalCase, kebab, snake, dotted and spaced names into lowercase words.

---

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