mirror of https://github.com/inhji/plug_micropub
add handler callback for ?q=channel requests
This commit is contained in:
parent
c6976ac951
commit
61fd55e9c0
|
@ -215,6 +215,15 @@ defmodule PlugMicropub do
|
||||||
end
|
end
|
||||||
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
|
defp parse_update_properties(properties) do
|
||||||
properties = Map.take(properties, ["replace", "add", "delete"])
|
properties = Map.take(properties, ["replace", "add", "delete"])
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,10 @@ defmodule PlugMicropub.HandlerBehaviour do
|
||||||
{:ok, map}
|
{:ok, map}
|
||||||
| handler_error
|
| handler_error
|
||||||
|
|
||||||
|
@callback handle_channel_query(access_token) ::
|
||||||
|
{:ok, map}
|
||||||
|
| handler_error
|
||||||
|
|
||||||
@callback handle_source_query(
|
@callback handle_source_query(
|
||||||
url :: String.t(),
|
url :: String.t(),
|
||||||
properties :: [String.t()],
|
properties :: [String.t()],
|
||||||
|
|
Loading…
Reference in New Issue