Intention: Build Clojure bindings for Google APIs from Google Discovery API
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.
service.users().list(customer='my_customer', maxResults=10,
orderBy='email').execute()
service.users().list()
.setCustomer("my_customer")
.setMaxResults(10)
.setOrderBy("email")
.execute();
var optionalArgs = {
customer: 'my_customer',
maxResults: 10,
orderBy: 'email'
};
var response = AdminDirectory.Users.list(optionalArgs);
r, err := srv.Users.List().Customer("my_customer").MaxResults(10).
OrderBy("email").Do()
Ruby is the outlier.
response = service.list_users(customer: "my_customer",
max_results: 10,
order_by: "email")
Cognitect’s bindings for AWS API are generated using the data descriptions from the AWS JavaScript library.
(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)
- 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