项目作者: zshipko

项目描述 :
Backblaze API for OCaml
高级语言: OCaml
项目地址: git://github.com/zshipko/ocaml-b2.git
创建时间: 2016-12-01T02:32:37Z
项目社区:https://github.com/zshipko/ocaml-b2

开源协议:MIT License

下载


ocaml-b2

ocaml-b2 provides OCaml bindings to the Backblaze B2 API.

Installation

  1. opam pin add b2 https://github.com/zshipko/ocaml-b2.git

API

All methods for version 1 of the B2 API can be found in the module B2.V1. The
OCaml API tries to mirror the Backblaze documentation as closely as possible.

See b2.mli for further details.

Usage

The following code sample prints out the name of each bucket after authenticating

  1. module API = B2.V1(Cohttp_lwt_unix.Client)
  2. let main =
  3. (* Get a token *)
  4. API.authorize_account ~account_id ~application_key >>= fun token ->
  5. (* Print existing bucket names *)
  6. API.list_buckets ~token
  7. >>= Lwt_list.iter (fun bucket ->
  8. Lwt_io.printl bucket.bucket_name)
  9. let _ = Lwt_main.run main