# amoorion.api.base

API: `POST /methods/<name>` with the method’s params as the body,
`POST /hooks/<name>` for incoming webhooks (kept in the inbox), `GET /` for
what is there.

Method calls need `Authorization: Bearer <api/token from the vault>`; without
that secret in the vault every method call is refused. Hooks verify
themselves (see amoorion.hooks).

### Functions

| [`create_app`](#amoorion.api.base.create_app)([vault, inbox, dataset])   | The FastAPI application: one route per method, the hooks, and a token check.   |
|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
| [`serve`](#amoorion.api.base.serve)(args)                           | Run the API until stopped: `amoorion api`.                                     |

### amoorion.api.base.create_app(vault=None, inbox=None, dataset=None)

The FastAPI application: one route per method, the hooks, and a token check.

Routes are made from `METHODS`, so a new method needs nothing here. Whatever isn’t
passed comes from the environment: the vault of `.env` and the default inbox.

* **Parameters:**
  * **vault** ([*Vault*](amoorion.vault.base.html.md#amoorion.vault.base.Vault) *|* *None*)
  * **inbox** ([*Inbox*](amoorion.inbox.base.html.md#amoorion.inbox.base.Inbox) *|* *None*)
  * **dataset** ([*Dataset*](amoorion.dataset.base.html.md#amoorion.dataset.base.Dataset) *|* *None*)
* **Return type:**
  *FastAPI*

### amoorion.api.base.serve(args)

Run the API until stopped: `amoorion api`.

* **Parameters:**
  **args** (*Namespace*)
* **Return type:**
  None
