# `PgRest.RPC.Args`
[🔗](https://github.com/agoodway/pgrest/blob/v0.2.0/lib/pg_rest/rpc/args.ex#L1)

Splits an RPC request into function arguments and row filters, as PostgREST's
`pRequestFilter`/`isRpcRead` do, and builds the arguments of the call.

On a read (GET/HEAD) the query string carries both: a key is a filter when it is reserved
or `PgRest.Grammar.Filter.parse_condition/2` accepts its value, and an argument otherwise.
On a POST every query parameter is a filter and the arguments are the keys of the JSON body
(an array body: the keys its objects share), or the `columns=` list when given.
A parameter without a value (`?a`) is dropped, as PostgREST's `nonemptyParams` does.

# `body_media`

```elixir
@spec body_media(Plug.Conn.t()) :: :json | :text | :xml | :bytea
```

The body media type of a `conn` (its `Content-Type`): `:text`, `:xml`, `:bytea`, or `:json`
for anything else, as PostgREST defaults to JSON.

# `call_args`

```elixir
@spec call_args(PgRest.Request.t(), PgRest.Function.t()) :: PgRest.Plan.Call.args()
```

The arguments of the call of `function` (`PgRest.Plan.Call` `args`). A read passes the
function's parameters the query string names (a variadic one every value in order, any other
the last). A JSON POST passes the raw body once, to `json_to_recordset`, or whole to a single
unnamed parameter; a non-JSON POST always reaches a single unnamed parameter.

# `check_body`

```elixir
@spec check_body(PgRest.Request.t()) :: :ok | {:error, PgRest.Error.t()}
```

Checks a JSON RPC body before resolution: an array must hold objects that all have the same
keys (`PGRST102`), as a bulk write's rows must. A `columns=` list must parse.

# `invocation`

```elixir
@spec invocation(PgRest.Request.t()) :: PgRest.RPC.Resolver.invocation()
```

How the request calls its function, for `PgRest.RPC.Resolver.resolve/5`.

# `split`

```elixir
@spec split(PgRest.Request.t(), PgRest.RPC.Resolver.invocation()) ::
  {[String.t()], [{String.t(), String.t()}]}
```

Returns `{argument_keys, filter_params}` for an invocation (`invocation/1`). Argument keys
are deduplicated; the resolver matches them as a set.

---

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