Giter Club home page Giter Club logo

gapi-ocaml's Introduction

Google APIs Client library for OCaml

gapi-ocaml is a simple, unofficial, OCaml client for Google Services. The library supports ClientLogin, OAuth 1.0a, and OAuth 2.0 authentication. Supported RESTful APIs:

  • Calendar APIs v3
  • Google+ API v1
  • Tasks API v1
  • APIs Discovery Service v1
  • URL Shortener API v1
  • OAuth2 API v2
  • Custom Search API v1
  • Google Analytics API v3
  • Page Speed Online API v1
  • Blogger API v2
  • Site Verification API v1
  • AdSense Management API v1.1
  • BigQuery API v2
  • Drive API v2
  • Drive API v3
  • Gmail API v1

Features

  • Monadic interface
  • Functional lenses to access data structures
  • Service generator (experimental): a tool for generating client libraries for APIs based on the Google API Discovery format

Building gapi-ocaml

Requirements

You will need the following libraries:

This library was developed and tested on Ubuntu LTS (64-bit).

Configuration and installation

To build the library, run

$ make

To install the library, run (as root, if your user doesn't have enough privileges)

$ make install

To build and run the tests, execute

$ make test

See src/test/README.md for further details regarding the tests.

To build the examples:

$ dune build @examples

See examples/README.md for further details regarding the examples.

To generate the documentation, run

$ make doc

Then you can browse the HTML documentation starting from gapi-ocaml.docdir/index.html, but is not installed by default.

To uninstall anything that was previously installed, execute

$ make uninstall

Usage

See auth examples in examples/auth for some examples of how to use Google's authorization endpoints.

See examples directory to find code samples that show usage of some services.

See tools/serviceGenerator.ml for a complex example of how to use functional lenses within the state monad.

See tools/README.md for the instructions of how to build and run the service generator utility.

Ocamlnet

To support OCaml 5, I removed the direct dependency on Ocamlnet. To do so, I imported (in the src directory) the netstring and netsys libraries from upstream, applied the patches from this PR, and further patched the code to compile and run correctly.

gapi-ocaml's People

Contributors

alessandro-barbieri avatar astrada avatar leonidas-from-xiv avatar pdonadeo avatar ptival avatar rgrinberg avatar shonfeder avatar thecbah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gapi-ocaml's Issues

Problem getting shared documents

In Documents List API binding, there is a bug that prevents fetching shared document metadata, if the document is not owned, but was shared by another user. The library doesn't expect a specific element in the XML entry (sharedWithMeDate) of shared documents, thus raising an exception.

release 3.9 does not build.

I'm trying to package release 0.3.9 and I'm getting build errors.

`[ 8s] + jbuilder build @install
[ 12s] ocamlc src/gapi/.gapi_ocaml.objs/gapiCurl.{cmo,cmt} (exit 2)
[ 12s] (cd _build/default && /usr/bin/ocamlc.opt -w @a-4-29-40-41-42-44-45-48-58-59-60-40 -strict-sequence -strict-formats -short-paths -keep-locs -w -3-23-27-32-33 -g -bin-annot -I src/gapi/.gapi_ocaml.objs -I src/gapi/.gapi_ocaml.objs/.private -I /usr/lib64/ocaml/biniou -I /usr/lib64/ocaml/bytes -I /usr/lib64/ocaml/cryptokit -I /usr/lib64/ocaml/curl -I /usr/lib64/ocaml/easy-format -I /usr/lib64/ocaml/extlib -I /usr/lib64/ocaml/netstring -I /usr/lib64/ocaml/netsys -I /usr/lib64/ocaml/num -I /usr/lib64/ocaml/threads -I /usr/lib64/ocaml/yojson -intf-suffix .ml -no-alias-deps -opaque -o src/gapi/.gapi_ocaml.objs/gapiCurl.cmo -c -impl src/gapi/gapiCurl.ml)
[ 12s] File "src/gapi/gapiCurl.ml", line 287, characters 6-7:
[ 12s] Warning 11: this match case is unused.
[ 12s] File "src/gapi/gapiCurl.ml", line 1:
[ 12s] Error: Some fatal warnings were triggered (1 occurrences)
[ 13s] ocamlopt src/gapi/.gapi_ocaml.objs/gapiCurl.{cmx,o} (exit 2)
[ 13s] (cd _build/default && /usr/bin/ocamlopt.opt -w @a-4-29-40-41-42-44-45-48-58-59-60-40 -strict-sequence -strict-formats -short-paths -keep-locs -w -3-23-27-32-33 -g -I src/gapi/.gapi_ocaml.objs -I src/gapi/.gapi_ocaml.objs/.private -I /usr/lib64/ocaml/biniou -I /usr/lib64/ocaml/bytes -I /usr/lib64/ocaml/cryptokit -I /usr/lib64/ocaml/curl -I /usr/lib64/ocaml/easy-format -I /usr/lib64/ocaml/extlib -I /usr/lib64/ocaml/netstring -I /usr/lib64/ocaml/netsys -I /usr/lib64/ocaml/num -I /usr/lib64/ocaml/threads -I /usr/lib64/ocaml/yojson -intf-suffix .ml -no-alias-deps -opaque -o src/gapi/.gapi_ocaml.objs/gapiCurl.cmx -c -impl src/gapi/gapiCurl.ml)
[ 13s] File "src/gapi/gapiCurl.ml", line 287, characters 6-7:
[ 13s] Warning 11: this match case is unused.
[ 13s] File "src/gapi/gapiCurl.ml", line 1:
[ 13s] Error: Some fatal warnings were triggered (1 occurrences)

`

Remove ocamlnet dependency

It's a pretty heavy dependency that requires C code. Would be great to do away with it for portability purposes.

What is ocamlnet being used for in gapi-ocaml? If it's not deeply embedded in the code I try removing it.

No support for yojson 2.x

I'm using google-drive-ocamlfuse which depends on gapi-ocaml under Arch Linux (using the AUR package), and since yojson has been updated to version 2.0.2, gapi-ocaml doesn't build anymore since it doesn't support the 2.x API.

For now I've worked around the issue by ignoring updates of the ocaml-yojson package in my /etc/pacman.conf file, but it would be great if gapi-ocaml would support the 2.0 version of yojson.

Can't compile

I failed trying to compile the source (f741ddf), while following the instructions in README.

The error is this:

src $ ocamlbuild gdata/gdata.cma
Finished, 1 target (0 cached) in 00:00:00.
+ ocamlfind ocamlc -c -dtypes -w A -warn-error A -w e -warn-error e -w z -warn-error z -package extlib -package netstring -I gdata -o gdata/gdataAuth.cmo gdata/gdataAuth.ml
File "gdata/gdataAuth.ml", line 65, characters 13-37:
Warning 9: the following labels are not bound in this record pattern:
client_id, client_secret, refresh_token
Either bind these labels explicitly or add `; _' to the pattern.
File "gdata/gdataAuth.ml", line 1, characters 0-1:
Error: Error-enabled warnings (1 occurrences)
Command exited with code 2.
Compilation unsuccessful after building 68 targets (0 cached) in 00:00:03.

Actually in line 65 of gdata/gdataAuth.ml an incomplete value of type oauth2_data is created.

Unclear where the `<--` operators in the monadic examples comes from

Looking at the monadic examples, I was surprised to find the absence of expected tokens bind, >>=, or let*, and instead an abundance of <-- operators. I haven't been able to build these examples or figure out where this operator comes from.

Perhaps we need to either update the examples or add some documentation on this operator?

Timestamps ignore milliseconds

Milliseconds in RFC 3339 timestamps are ignored, causing issues with Google Drive file creation, because creation date is not modifiable.

Resumable upload bug

  • Request to update metadata is retried as if upload already started
  • PUT/PATCH with empty body causes thread to hang indefinitely

Concurrent execution?

HI! I'm looking for some tips on concurrent execution of API calls. Ideally, it'd be nice to add support for Lwt (I'm happy to put some work into this, if it'd feasible and welcome), but I'm hoping that -- one way or another -- there's a fairy low overhead way of getting current API calls working.

Any pointers/thoughts on this front?

Remove Extlib dependency

extlib conflicts with base64. base64 would probably make for a nicer decoding experience than Netencoding, take one more step towards #10. More compelling: extlib advertises itself as deprecated for new code on its repo, and both mrmime and email_message depend on base64, and either would be useful in conjunction with this library.

Add support for Google Sheets API v4?

Greetings! Would you be open to adding support for the Sheets API? I'd be willing to have a go at running the generation tooling and seeing if I could open a PR to add the result, if so.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.