package bizowie-api
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=07c0dc70d15c416aad030ace0ca00f02
sha512=32a887878afc94f99ef34b588145b9e95fc4ea071482015a341692bce843c8fd43dff0991945aabddfc973c1e8348b702f366c13cf71f82f86250ff2fa79b797
Description
OCaml port of WWW::Bizowie::API for the Bizowie ERP platform (https://bizowie.com). Supports both v1 (multipart) and v2 (JSON) API endpoints.
Added to opam-repository:
README
bizowie-api (OCaml)
OCaml client for the Bizowie ERP API. Port of the Perl module WWW::Bizowie::API.
- Minimum OCaml: 4.14
- Built on
cohttp-lwt-unix,lwt,yojson - Supports both v1 (multipart) and v2 (JSON) endpoints
- Both Lwt and blocking interfaces
Install
opam install bizowie-apiUsage
Blocking
let bz =
Bizowie_api.create
~api_key:"02cc7058-cd22-4c8e-ad7c-a8f3f2a64bd0"
~secret_key:"58c57abc-1e16-3571-bb35-73876bcef746"
~site:"mysite.bizowie.com"
()
in
let resp =
Bizowie_api.call_sync bz
"databases/add_note/3/10/123"
(`Assoc [("comment", `String "I added this comment via the API!")])
in
if resp.success then
print_endline (Yojson.Safe.pretty_to_string resp.data)Lwt
open Lwt.Infix
let main =
let bz =
Bizowie_api.create
~api_key:"..." ~secret_key:"..." ~site:"mysite.bizowie.com" ()
in
Bizowie_api.call bz "things/list" (`Assoc [])
>|= fun resp ->
if resp.success then print_endline (Yojson.Safe.to_string resp.data)
let () = Lwt_main.run mainv2 endpoint
let bz =
Bizowie_api.create
~api_key:"..." ~secret_key:"..." ~site:"mysite.bizowie.com"
~v2:true
()Options
Argument | Default | Description |
|---|---|---|
| required | Bizowie API key. |
| required | Bizowie secret key. |
| required | Hostname of your Bizowie instance. |
|
| Use the v2 API endpoint. |
|
| API version sent with v2 requests. |
|
| Print raw response to stderr on JSON decode fail. |
|
| Override the HTTP transport (useful for tests). |
Responses
type response = {
data : Yojson.Safe.t; (* response body, success field stripped *)
success : bool; (* extracted from the success field *)
}If the body isn't parseable as JSON, data is `Assoc [("unprocessed", `Int 1)] and success is false.
Build / Test
opam install . --deps-only --with-test
dune build
dune runtestPublishing to opam-repository
opam packages live in the ocaml/opam-repository GitHub repo. Easiest tooling: opam-publish.
One-time setup
opam install opam-publishRelease flow
Tag the release in git and push the tag:
git tag -a v0.5.0 -m "0.5.0" git push origin v0.5.0- Create a GitHub release for the tag (so opam-publish can find the tarball).
Run:
opam publish https://github.com/mjflick/bizowie-api-ocaml/releases/download/v0.5.0/bizowie-api-0.5.0.tar.gzopam-publishwill:- download the tarball, compute its SHA256,
- generate
packages/bizowie-api/bizowie-api.0.5.0/opam, - fork
ocaml/opam-repositoryon your behalf, - open a pull request.
- A maintainer will run the package through
opam-ci(build matrix across OCaml versions and platforms) and merge once green. Typical turnaround: a few hours to a couple of days.
Manual alternative
If you prefer to do it by hand:
- Fork
ocaml/opam-repository. Create
packages/bizowie-api/bizowie-api.0.5.0/opam— copy from thebizowie-api.opamin the source tree and add aurlstanza:url { src: "https://github.com/mjflick/bizowie-api-ocaml/archive/refs/tags/v0.5.0.tar.gz" checksum: "sha256=PUT_SHA256_HERE" }You can compute the checksum with:
curl -sL <URL> | sha256sum- Open a PR against
ocaml/opam-repository.
License
Dual-licensed under the Artistic License 1.0 (Perl) or GPL 1.0 or later, matching the original Perl module's "same terms as Perl itself" clause.