Closed tmcgilchrist closed 3 years ago
I have an issue while testing the weekly commit count API function: an error occurs during the parsing:
Testing weekly commit count.
Fatal error: exception (Failure
"Bad response: Yojson.Json_error(\"Line 1, bytes 0-33:\\nExpected '{' but found '[[1329609600,5896,-6],[1330214400'\")\
\nJSON body:\
\n[\
\n [ 1329609600, 5896, -6 ],\
\n [ 1330214400, 1848, -1339 ],\
\n [ 1330819200, 0, 0 ],\
[....]
\n [ 1598140800, 0, 0 ],\
\n [ 1598745600, 39, -5 ],\
\n [ 1599350400, 0, 0 ]\
\n]")
Here is the snippet I used to test the function:
let test_weekly_commit_count =
let token = ... in
let user = "mirage" in
let repo = "ocaml-github" in
let open Github in
Format.printf "Testing weekly commit count.@.";
let weekly_count =
let t =
let open Monad in
run (Stats.weekly_commit_count ~token ~user ~repo () >|= Response.value)
in
Lwt_main.run t
in
let pp_sep fmt () = Format.fprintf fmt "; " in
Format.printf " all: [ %a ]@."
(Format.pp_print_list ~pp_sep Format.pp_print_int)
weekly_count.Github_t.participation_all;
Format.printf " owner: [ %a ]@."
(Format.pp_print_list ~pp_sep Format.pp_print_int)
weekly_count.Github_t.participation_owner
I've added a rudimentary executable that pokes at mirage/ocaml-github
and dumps a partially formatted representation to stdout. Is there anything else you'd like to see added @Aaylor @avsm ?
Thanks, it looks good to me; I've run succesfully the different endpoints.
See https://github.com/mirage/ocaml-github/issues/86 and https://developer.github.com/v3/repos/statistics/.