analytics/lib/plausible_web/plugins/api/views/capabilities.ex
hq1 6035618213
Add GET /capabilities to Plugins API (#3808)
* Add `GET /capabilities` to Plugins API

It aims to:

 - help the client verify the data-domain the token is associated with
 - list all the features available for the site's owner
   (and therefore determine availability of the subset of those for the current
   Plugins API caller)

The endpoint does not require authentication, in the sense that it'll
always respond with 200 OK. However when the token is provided,
a verification lookup is made.

* Remove IO.inspect() call

* Credo

* Aesthetics

* s/send_resp/send_error/

* Call preload just once
2024-02-21 12:41:56 +01:00

11 lines
286 B
Elixir

defmodule PlausibleWeb.Plugins.API.Views.Capabilities do
@moduledoc """
View for rendering Capabilities on the Plugins API
"""
use PlausibleWeb, :plugins_api_view
def render("index.json", %{capabilities: capabilities}) when is_map(capabilities) do
capabilities
end
end