The simplest approach creates wrapper functions for the web service at
compile time. This reduces startup time for your
application. Furthermore, it means that you don’t need to ship the
|(require (planet gh/gapi:1:=0/macro))|
Each function makes an HTTP request to the web service. The function takes normal arguments for parameters that are defined as required, whereas optional keyword arguments are used to represent other parameters. These values are supplied in the HTTP request to the service.
The web service responds with JSON, which is returned by this function as a jsexpr?. This library doesn’t try to marshal the response into structs. Instead you will need to understand its format and retrieve the information, for example (hash-ref js 'items) if the response contains a list of items.
As a convenience, the #:key argument (which corresponds to the key query parameter in the HTTP request) defaults to the api-key Racket parameter. Put your Google API key in a file named .google-api-key in your home directory–in other words, ~/.google-api-key.
As another convenience, see the paged form which simplifies making repeated calls to a service that returns results in small "pages" (batches of results).
If discovery-document-name is a fully qualified pathname, then it will be loaded.
Otherwise if discovery-document-name has no path (i.e. if path-only returns #f) then it must be located in the vendor subdirectory of the GAPI collection. The currently available service documents are:
adexchangebuyer.v1.1.js : Lets you manage your Ad Exchange Buyer account.
adsense.v1.1.js : Gives AdSense publishers access to their inventory and the ability to generate reports
adsensehost.v4.1.js : Gives AdSense Hosts access to report generation, ad code generation, and publisher management capabilities.
analytics.v3.js : View and manage your Google Analytics data
androidpublisher.v1.js : Lets Android application developers access their Google Play accounts.
audit.v1.js : Lets you access user activities in your enterprise made through various applications.
bigquery.v2.js : A data platform for customers to create, manage, share and query data.
blogger.v3.js : API for access to the data within Blogger.
books.v1.js : Lets you search for books and manage your Google Books library.
calendar.v3.js : Lets you manipulate events and other calendar data.
civicinfo.us_v1.js : An API for accessing civic information.
compute.v1beta12.js : API for the Google Compute Engine service.
coordinate.v1.js : Lets you view and manage jobs in a Coordinate team.
customsearch.v1.js : Lets you search over a website or collection of websites
dfareporting.v1.1.js : Lets you create, run and download reports.
discovery.v1.js : Lets you discover information about other Google APIs, such as what APIs are available, the resource and method details for each API
drive.v2.js : The API to interact with Drive.
freebase.v1.js : Lets you access the Freebase repository of open data.
fusiontables.v1.js : API for working with Fusion Tables data.
gan.v1beta1.js : Lets you have programmatic access to your Google Affiliate Network data.
groupssettings.v1.js : Lets you manage permission levels and related settings of a group.
latitude.v1.js : Lets you read and update your current location and work with your location history
licensing.v1.js : Licensing API to view and manage license for your domain.
moderator.v1.js : Moderator API
oauth2.v2.js : Lets you access OAuth2 protocol related APIs.
orkut.v2.js : Lets you manage activities, comments and badges in Orkut. More stuff coming in time.
pagespeedonline.v1.js : Lets you analyze the performance of a web page and get tailored suggestions to make that page faster.
plus.v1.js : The Google+ API enables developers to build on top of the Google+ platform.
prediction.v1.5.js : Lets you access a cloud hosted machine learning service that makes it easy to build smart apps
reseller.v1.js : Lets you create and manage your customers and their subscriptions.
shopping.v1.js : Lets you search over product data.
siteVerification.v1.js : Lets you programatically verify ownership of websites or domains with Google.
storage.v1beta1.js : Lets you store and retrieve potentially-large, immutable data objects.
taskqueue.v1beta2.js : Lets you access a Google App Engine Pull Task Queue over REST.
tasks.v1.js : Lets you manage your tasks and task lists.
translate.v2.js : Lets you translate text from one language to another
urlshortener.v1.js : Lets you create, inspect, and manage goo.gl short URLs
webfonts.v1.js : The Google Web Fonts Developer API.
youtube.v3.js : Programmatic access to YouTube features.
youtubeAnalytics.v1.js : Retrieve your YouTube Analytics reports.
(require gapi/macro) (require-gapi-doc "urlshortener.v1.js") (define orig-url "http://www.racket-lang.org/") (define js-insert (urlshortener-url-insert #:longUrl orig-url)) (define short-url (dict-ref js-insert 'id)) (define js-get (urlshortener-url-get short-url)) (define long-url (dict-ref js-get 'longUrl)) (printf "~s was shortened to ~s, which expanded back to ~s: ~a" orig-url short-url long-url (if (equal? orig-url long-url) "Yay!" "Boo!"))