googleapi

Google API for nim

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Tags

Installation

nimble install googleapi
choosenim install googleapi
git clone https://github.com/treeform/googleapi

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
googleapi - - - - - - -

Source

Repository https://github.com/treeform/googleapi
Homepage https://github.com/treeform/googleapi
Registry Source nimble_official

README

Google API - for Nim.

nimble install googleapi

Github Actions

API reference

About

This is a growing collection of google APIs for nim.

So far it has basic support for:

  • BigQuery
  • Compute
  • Datastore
  • Spreadsheets
  • Documents
  • Drive
  • Storage

Feel free to add new services as they are wrapped. But it might just be easier to use REST Api.

Different jwt backends:

  • default: https://github.com/yglukhov/nim-jwt (takes really long to compile)
  • -d:googleApiUseQuickJwt quickjwt: https://github.com/treeform/quickjwt (segfaults with wrong libcrypto setup)
  • -d:googleApiUseJwtea jwtea: https://github.com/guzba/jwtea (pure nim but can take a second to compute)

REST API

But you can always access Google API through REST. For example find the REST documniation you want like:

https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/runQuery

There you see a url and the json to send:

POST https://datastore.googleapis.com/v1/projects/{projectId}:runQuery

Just construct your own JSON and use con.get, con.post, con.put or con.delete:

const dsRoot = "https://datastore.googleapis.com/v1"
let data = %* {
  "gqlQuery": {
    "allowLiterals": true,
    "queryString": queryString
  }
}
return await conn.post(&"{dsRoot}/projects/{projectId}:runQuery", data)

No now you can use any google library with this trick!

Service accounts

There are many ways to access google APIs but the best way is service accounts. In the end you'll end up using service accounts so might as well start now.

You can create a service account here: https://cloud.google.com/iam/docs/creating-managing-service-accounts

Then you download the JSON for your service account and load that to create a connection.

var conn = await newConnection("your_service_account.json")

Service account is like an email + public key (with with some extra JSON) that you use to access any google service.

You might run into permission issues with your service account, simply share any google project/service/dataset/page/document/sheet/table ... with the email of the service account, like as if it was a real person.