# `WardrikOAuth.Request`

Sends a flow's requests to an authorization server.

Each function takes `Req` options, plus `:check`, a function called on each URL first. URLs
must be `https`, or `http` on localhost.

# `get_json`

```elixir
@spec get_json(String.t(), keyword()) :: {:ok, map()} | {:error, term()}
```

Gets JSON from `url`.

# `post_as`

```elixir
@spec post_as(String.t(), WardrikOAuth.Provider.t(), map(), keyword()) ::
  {:ok, pos_integer(), map()} | {:error, term()}
```

Posts `form` to `url` as `provider`'s client. Returns the status and the JSON body.

The client secret goes in the form, or in an HTTP Basic header if `client_auth` is `:basic`.

# `post_json`

```elixir
@spec post_json(String.t(), map(), keyword()) ::
  {:ok, pos_integer(), map()} | {:error, term()}
```

Posts `body` to `url` as JSON. Returns the status and the JSON body.

# `present`

```elixir
@spec present(map(), String.t(), term()) :: map()
```

Puts `value` in `form` under `key`, unless it's `nil` or `""`.

# `refusal`

```elixir
@spec refusal(pos_integer(), map()) :: {:token_refused, String.t(), String.t() | nil}
```

Returns an OAuth error response as `{:token_refused, error, description}`.

---

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