All commits#245
Conversation
|
Thanks for the PR! I've pushed a merge commit to get the CI green on your branch. |
|
Thanks! |
|
@Stevendeo the linting issue is fixed on |
tmcgilchrist
left a comment
There was a problem hiding this comment.
Thanks for the PR @Stevendeo. I suggest you use the Stream module, comments inline.
Git rebase/merge/cherry-pick the branch and I can merge it.
The releases.ml test code uses a streamed listing of releases in a repository, as an example of how to consume s 'a Stream.t
| val get_commits : | ||
| ?token:Token.t -> | ||
| user:string -> repo:string -> | ||
| unit -> Github_t.commits Response.t Monad.t | ||
| (** [get_commits ~user ~repo ()] lists all commits in [user]/[repo]. *) |
There was a problem hiding this comment.
This could be improved by using Stream.t since the response is paginated, the Stream module provides an abstraction over GitHub's paginated endpoints.
| val get_commits : | |
| ?token:Token.t -> | |
| user:string -> repo:string -> | |
| unit -> Github_t.commits Response.t Monad.t | |
| (** [get_commits ~user ~repo ()] lists all commits in [user]/[repo]. *) | |
| val get_commits : | |
| ?token:Token.t -> | |
| user:string -> repo:string -> | |
| unit -> Github_t.commit Stream.t | |
| (** [get_commits ~user ~repo ()] stream of all commits in [user]/[repo]. *) |
| let get_commits ?token ~user ~repo () = | ||
| let uri = URI.repo_commits ~user ~repo in | ||
| API.get ?token ~uri (fun b -> return (commits_of_string b)) |
There was a problem hiding this comment.
Using get_stream this should be something like
| let get_commits ?token ~user ~repo () = | |
| let uri = URI.repo_commits ~user ~repo in | |
| API.get ?token ~uri (fun b -> return (commits_of_string b)) | |
| let get_commits ?token ~user ~repo () = | |
| let uri = URI.repo_commits ~user ~repo in | |
| let fail_handlers = [ | |
| API.code_handler | |
| ~expected_code:`Not_found | |
| (fun _ -> Lwt.return []) | |
| ] in | |
| API.get_stream ?token ~uri ~fail_handlers (fun b -> return (commits_of_string b)) |
|
Thanks for the review, I just fixed my commit with the Stream module |
CHANGES: - Fixes to odoc warnings and cohttp dependencies (@Aaylor mirage/ocaml-github#244) - Support cohttp 4.0. (@tmcgilchrist mirage/ocaml-github#257) - Support for 4.12 and fixing recent compiler warnings (@tmcgilchrist mirage/ocaml-github#246 mirage/ocaml-github#252 and @emillon mirage/ocaml-github#250 mirage/ocaml-github#247 mirage/ocaml-github#251) - Add a new package `github-data` which contains just the serialisation logic without a dependency on the web stack (mirage/ocaml-github#248 @emillon) - Add Github checks API support (mirage/ocaml-github#249 @tmcgilchrist) - Label field missing in branch refs for ghost (@dra27 and @tmcgilchrist mirage/ocaml-github#256) - Get all commits for user/repo (@Stevendeo mirage/ocaml-github#245)
Adding a 'get_all_commits' request