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
|
||||
|
||||
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"])
|
||||
|
||||
|
|
|
@ -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()],
|
||||
|
|
Loading…
Reference in New Issue