diff --git a/lib/plug_micropub.ex b/lib/plug_micropub.ex index 5e0332e..92901d0 100644 --- a/lib/plug_micropub.ex +++ b/lib/plug_micropub.ex @@ -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"]) diff --git a/lib/plug_micropub/handler_behaviour.ex b/lib/plug_micropub/handler_behaviour.ex index e324d8d..c5733e5 100644 --- a/lib/plug_micropub/handler_behaviour.ex +++ b/lib/plug_micropub/handler_behaviour.ex @@ -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()],