mirror of
https://github.com/chshersh/github-tui.git
synced 2024-10-26 19:10:04 +03:00
19 lines
561 B
OCaml
19 lines
561 B
OCaml
let github_api_url = "https://api.github.com/graphql"
|
|
|
|
let query query_body =
|
|
let token = Sys.getenv "GITHUB_TOKEN" in
|
|
let response =
|
|
Ezcurl.post
|
|
~params:[]
|
|
~headers:
|
|
[
|
|
("Authorization", "bearer " ^ token) ;
|
|
("User-Agent", "chshersh/github-tui")
|
|
]
|
|
~content:(`String (Printf.sprintf "{ \"query\": %S }" query_body))
|
|
~url:github_api_url
|
|
()
|
|
in
|
|
match response with
|
|
| Error (_code, msg) -> Printf.sprintf "Error: %s" msg
|
|
| Ok response -> response.body |