-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#48] Moving all the backend calls to Coophub.Backends and changing t…
…he behaviour to just have the minimal needed specific implementation.
- Loading branch information
1 parent
e470995
commit f463721
Showing
4 changed files
with
228 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
defmodule Coophub.Backends.Behaviour do | ||
alias Coophub.Backends | ||
alias Coophub.Schemas.{Organization, Repository} | ||
|
||
@type org :: Organization.t() | ||
@type repo :: Repository.t() | ||
@type langs :: Backends.languages() | ||
@type results :: | ||
:error | ||
| org | ||
| repo | ||
| [repo] | ||
| [map] | ||
| [String.t()] | ||
| langs | ||
@type request :: Backends.request() | ||
@type org :: Backends.org() | ||
@type repo :: Backends.repo() | ||
@type langs :: Backends.langs() | ||
@type topics :: Backends.topics() | ||
|
||
@callback get_org(String.t(), map) :: org | :error | ||
@callback get_members(org) :: [map] | ||
@callback get_repos(org) :: [repo] | ||
@callback get_topics(org, repo) :: [String.t()] | ||
@callback get_languages(org, repo) :: langs | ||
@callback name() :: String.t() | ||
|
||
@callback request_org(String.t(), map) :: request | ||
@callback parse_org(map) :: org | ||
|
||
@callback request_members(org) :: request | ||
@callback parse_members([map]) :: [map] | ||
|
||
@callback request_repos(org, integer) :: request | ||
@callback request_repo(org, map) :: request | ||
@callback parse_repo(map) :: repo | ||
|
||
@callback request_topics(org, repo) :: request | ||
@callback parse_topics(any) :: topics | ||
|
||
@callback request_languages(org, repo) :: request | ||
@callback parse_languages(any) :: langs | ||
end |
Oops, something went wrong.