@@ -12,8 +12,9 @@ defmodule CodeCorps.GitHub.API.Repository do
1212
1313 @ spec issues ( GithubRepo . t ) :: { :ok , list ( map ) } | { :error , GitHub . api_error_struct }
1414 def issues ( % GithubRepo { github_app_installation: % GithubAppInstallation { } = installation } = github_repo ) do
15- with { :ok , access_token } <- installation |> API.Installation . get_access_token ( ) ,
16- issues <- github_repo |> fetch_issues ( access_token ) do
15+ with { :ok , access_token } <- API.Installation . get_access_token ( installation ) ,
16+ issues <- fetch_issues ( github_repo , access_token )
17+ do
1718 { :ok , issues }
1819 else
1920 { :error , error } -> { :error , error }
@@ -25,24 +26,6 @@ defmodule CodeCorps.GitHub.API.Repository do
2526 path = "repos/#{ owner } /#{ repo } /issues"
2627 params = [ per_page: per_page , state: "all" ]
2728 opts = [ access_token: access_token , params: params ]
28-
29- # stream/lazy
30- # before_operation = Timex.now
31- # results = path |> fetch_lazy(opts)
32- # after_operation = Timex.now
33- # count = results |> Enum.count
34- # pages = count / per_page |> Float.round
35- # elapsed = Timex.diff(after_operation, before_operation)
36- # IO.puts("Stream: #{count} records, #{per_page} records per page, #{pages} pages total, #{elapsed} microseconds")
37-
38- # eager
39- GitHub . eager_get_all ( path , % { } , opts )
40- end
41-
42- defp fetch_lazy ( path , opts ) do
43- path
44- |> GitHub . lazy_get_all ( % { } , opts )
45- |> Enum . to_list
46- |> List . flatten
29+ GitHub . get_all ( path , % { } , opts )
4730 end
4831end
0 commit comments