# Mpx
**Elixir wrapper for the Ministry Platform REST API**
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `mpx` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:mpx, "~> 0.1.2"}
]
end
```
## Usage
Currently only a few endpoints are supported:
* `/tables` (get and delete)
* `/tables/:id` (get)
Set configuration options to authenticate with MP in your config.exs. You can use
`{:system, "ENV_NAME"}` for runtime configuration.
```elixir
config :mpx,
mp_base_url: {:system, "MP_HOST"},
mp_username: System.get_env("MP_USERNAME"),
mp_password: {:system, "MP_PASSWORD"},
mp_client_id: {:system, "MP_CLIENT_ID"},
mp_client_secret: {:system, "MP_CLIENT_SECRET"}
```
Now call
```elixir
{:ok, token} = Mpx.authenticate()
```
to get a reuseable authentication token.
If you prefer not to use elixir configuration to setup you user credentials:
```elixir
{:ok, token} = Mpx.authenticate(username: "username", password: "password", client_id: "clientid", client_secret: "clientsecret")
```