package b0
Software construction and deployment kit
Install
dune-project
Dependency
Authors
Maintainers
Sources
b0-0.0.6.tbz
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.std/B0_github/index.html
Module B0_github
Source
GitHub interaction.
See an example.
GitHub authentication
GitHub API requests
The type for content types.
The type for GitHub V3 request bodies. Either JSON or something else tagged with its content type or nothing.
Source
val req_json_v3 :
?headers:B0_http.Http.headers ->
B0_http.Http_client.t ->
Auth.t ->
path:string ->
B0_http.Http.method' ->
v3_body ->
(B0_json.Json.t, string) result
req_json_v3 auth path m ~headers body
performs the request for json on path
using method m
, additional headers headers
, body body
and authentication auth
.
query_v4 auth q
performs the the GitHub GraphQL V4 query q
using authentication auth
.
Higher-level interface
Pull requests
Example
This example opens an issue on the repo of a owner given an URL. The owner and repo is determined from the URL with Repo.of_url
, it works with links to git repos on github repos or their landing page.
open B0_std
open Result.Syntax
let open_issue ~user ~repo_url ~title ~body =
let* httpc = B0_http.Http_client.make () in
let* auth = B0_github.Auth.make ~user () in
let* repo = B0_github.Repo.of_url repo_url in
let* num, url = B0_github.Issue.open' httpc auth repo ~title ~body () in
let* path = match B0_url.path url with
| None -> Fmt.error "No path in returned url %s" url
| Some path -> Ok path
in
let* json = B0_github.req_json_v3 httpc auth ~path `GET `Empty in
let* html_url = B0_json.Jsonq.(query (mem "html_url" string)) json in
Log.stdout (fun m -> m "@[%s@]" html_url);
Ok ()
let user = None (* See B0_github.Auth.make to see how one is looked up. *)
let title = "TODO"
let body =
{|TODO|}
let main () =
Log.if_error ~use:1 @@
let* () = open_issue ~user ~repo_url:Sys.argv.(1) ~title ~body in
Ok 0
let () = if !Sys.interactive then () else exit (main ())
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page