{"id":13476596,"url":"https://github.com/anmonteiro/piaf","last_synced_at":"2025-04-10T03:54:50.272Z","repository":{"id":40511228,"uuid":"225135539","full_name":"anmonteiro/piaf","owner":"anmonteiro","description":"Web library for OCaml with support for HTTP/1.X / HTTP/2","archived":false,"fork":false,"pushed_at":"2025-01-06T00:33:02.000Z","size":978,"stargazers_count":204,"open_issues_count":12,"forks_count":24,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-10T03:54:43.731Z","etag":null,"topics":["http","http-client","http2","http2-client","https","https-client","ocaml"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anmonteiro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-12-01T09:24:29.000Z","updated_at":"2025-02-11T23:20:15.000Z","dependencies_parsed_at":"2023-02-18T12:03:31.175Z","dependency_job_id":"4837c2e7-1aad-4cb7-a710-d98f81926be7","html_url":"https://github.com/anmonteiro/piaf","commit_stats":{"total_commits":238,"total_committers":11,"mean_commits":"21.636363636363637","dds":0.0798319327731093,"last_synced_commit":"3870acbadda43ea1a68f59a5825745c1e9b3382a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anmonteiro%2Fpiaf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anmonteiro%2Fpiaf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anmonteiro%2Fpiaf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anmonteiro%2Fpiaf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anmonteiro","download_url":"https://codeload.github.com/anmonteiro/piaf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154999,"owners_count":21056542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","http-client","http2","http2-client","https","https-client","ocaml"],"created_at":"2024-07-31T16:01:32.392Z","updated_at":"2025-04-10T03:54:50.242Z","avatar_url":"https://github.com/anmonteiro.png","language":"OCaml","funding_links":[],"categories":["OCaml","Networking"],"sub_categories":[],"readme":"# piaf\n\nPiaf is a client library for the HTTP/1.X and HTTP/2 protocols written entirely\nin OCaml.\n\n## Installation\n\nPiaf is released to OPAM.\n\nYou can depend on it by running `opam install piaf`.\n\n_Note_: make sure to mirror Piaf's own resolutions located in the [opam\nfile](./piaf.opam).\n\n# Usage \u0026 Examples\n\nTODO, read the [mli](./lib/piaf.mli) file for now.\n\n### Examples\n\n```ml\nopen Piaf\n\nlet get_sync env ~sw url =\n  print_endline \"Sending request...\";\n  match Client.Oneshot.get ~sw env (Uri.of_string url) with\n  | Ok response -\u003e\n    if Status.is_successful response.status\n    then Body.to_string response.body\n    else\n      let message = Status.to_string response.status in\n      Error (`Msg message)\n  | Error e -\u003e failwith (Error.to_string e)\n\nlet () =\n  Eio_main.run (fun env -\u003e\n      Eio.Switch.run (fun sw -\u003e\n          match get_sync env ~sw \"https://example.com\" with\n          | Ok body -\u003e print_endline body\n          | Error error -\u003e\n            let message = Error.to_string error in\n            prerr_endline (\"Error: \" ^ message)))\n```\n\nThere's a more substantive example of using Piaf's API in\n[bin/carl.ml](./bin/carl.ml), an implementation of a subset of curl, in caml.\n\n## Development\n\nThere's two ways to get a development environemnt up and running. If you have (or don't mind getting) [`nix`](https://nixos.org/nix/manual/) installed, the repository includes scripts to set up a sandbox. Otherwise you can use [`opam`](https://opam.ocaml.org/) to install the necessary dependencies globally.\n\n### Option 1) Setting up the sandbox\n\nAssuming [`nix` has been installed](https://nix.dev/tutorials/install-nix.html) and set up, run `nix develop -c $SHELL` in the repository root. Once it's done building, you should have the development environment set up!\n\n### Option 2) Setting up opam\n\nFor this approach you'll need to [install `opam`](https://opam.ocaml.org/doc/Install.html)  and set it up with a switch using `ocaml` \u003e= 4.08. Once that's done, run `opam pin . --deps-only` to install the dependencies.\n\nNote that this installs the dependencies globally, and that the development environment is dependent on the switch used.\n\n### Building\n\nRun `dune build` to build, `dune build --watch` to run a watcher daemon that will build incrementally.\n\n### Running examples\n\nRun `dune exec examples/docs/readme.exe` to run the simple example above.\n\nRun `dune exec bin/carl.exe` to run `carl`, the `curl`-like example.\n\n## License \u0026 Copyright\n\nCopyright (c) 2019 António Nuno Monteiro\n\npiaf is distributed under the 3-Clause BSD License, see [LICENSE](./LICENSE).\n\nThe `vendor/multipart_form` directory contains a fork of\n[`multipart_form`](https://github.com/dinosaure/multipart_form) which is\nlicensed under the MIT License.\n[`multipart_form.LICENSE`](./multipart_form.LICENSE) reproduces the original\nlicense text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanmonteiro%2Fpiaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanmonteiro%2Fpiaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanmonteiro%2Fpiaf/lists"}