Skip to content

Commit 4d5b09b

Browse files
begedinjoshsmith
authored andcommitted
Added CodeCorps.GitHub.Event.Handler behaviour
1 parent a7d4cca commit 4d5b09b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
defmodule CodeCorps.GitHub.Event.Handler do
2+
@moduledoc ~S"""
3+
Default behavior for all GitHub webhook event handlers.
4+
"""
5+
6+
alias CodeCorps.GithubEvent
7+
8+
@doc ~S"""
9+
The only entry point a GitHub webhook event handler function should contain.
10+
11+
Receives a `CodeCorps.GithubEvent` record and a payload, returns an `:ok`
12+
tuple if the process was successful, or an `:error` tuple, where the second
13+
element is an atom, if it failed.
14+
"""
15+
@callback handle(GithubEvent.t, map) :: {:ok, any} | {:error, atom}
16+
end

0 commit comments

Comments
 (0)