add handler callback for ?q=channel requests

This commit is contained in:
Inhji 2022-03-03 21:20:53 +01:00
parent c6976ac951
commit 61fd55e9c0
2 changed files with 13 additions and 0 deletions

View File

@ -215,6 +215,15 @@ defmodule PlugMicropub do
end
end
defp handle_query(:channel, access_token, conn) do
handler = conn.private[:plug_micropub][:handler]
case handler.handle_channel_query(access_token) do
{:ok, content} -> send_content(conn, content)
error -> send_error(conn, error)
end
end
defp parse_update_properties(properties) do
properties = Map.take(properties, ["replace", "add", "delete"])

View File

@ -44,6 +44,10 @@ defmodule PlugMicropub.HandlerBehaviour do
{:ok, map}
| handler_error
@callback handle_channel_query(access_token) ::
{:ok, map}
| handler_error
@callback handle_source_query(
url :: String.t(),
properties :: [String.t()],