Skip to content

agstubbs/gappy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gappy

Intention: Build Clojure bindings for Google APIs from Google Discovery API

Design

Other Language Bindings for Google APIs

Looking at the other language bindings that exist, conceptually, each API is split into a number of different Resources, each Resource having a number of functions associated with it, and this is basically in line with the structure of the discovery document. Compare and contrast.

Looking at the sample code from the Google Workspace Admin SDK Directory API Get Started documentation we can see an idiom that crosses several languages.

Python

service.users().list(customer='my_customer', maxResults=10,
                                orderBy='email').execute()

Java

service.users().list()
                .setCustomer("my_customer")
                .setMaxResults(10)
                .setOrderBy("email")
                .execute();

JavaScript

var optionalArgs = {
    customer: 'my_customer',
    maxResults: 10,
    orderBy: 'email'
  };
var response = AdminDirectory.Users.list(optionalArgs);

Go

r, err := srv.Users.List().Customer("my_customer").MaxResults(10).
                OrderBy("email").Do()

Ruby

Ruby is the outlier.

response = service.list_users(customer:    "my_customer",
                              max_results: 10,
                              order_by:    "email")

Cognitect example: AWS API

Cognitect’s bindings for AWS API are generated using the data descriptions from the AWS JavaScript library.

First fix: map based, resource based

(Thus far) unspoken aim is for compatibility with ClojureScript and Babashka in addition to Clojure “Classic”.

Interface something along these lines is first idea

(def client (ns/client :admin :directory_v1))
(def users-resource (ns/resource client :users))
(ns/ops users-resource)
(ns/doc-str users-resource :list)

Dependencies

clojure
https://github.com/clojure/clojure
core async
https://github.com/clojure/core.async
cprop
https://github.com/tolitius/cprop
mount
https://github.com/tolitius/mount
cheshire
https://github.com/dakrone/cheshire
uritemplate-clj
https://github.com/mwkuster/uritemplate-clj
clj-http
https://github.com/dakrone/clj-http
ring
https://github.com/ring-clojure/ring
ring-http-response
https://github.com/metosin/ring-http-response
log4j
https://logging.apache.org/log4j/2.x/index.html

About

Clojure for Google Discovery API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published