Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 1.22 KB

README.md

File metadata and controls

32 lines (22 loc) · 1.22 KB

POC for a Typescript Grist client

This is a POC for a Typescript Grist API client.

It uses openapi-typescript-codegen to generate the API client and the OpenAPI documentation of Grist (source code).

What should I look at?

What interest us is the process that generates the client (./generate_client.sh) and also the use of the client (./cli-sample.ts).

Quick start for the POC demo

Just run the following commands:

$ npm install
$ npm run generate-client
$ ts-node ./cli-sample.ts --help

To list the content of a table:

$ ts-node ./cli-sample.ts -b BEARER -d DOC_ID -t TABLE_ID -u http://localhost:8484/api

To insert a record (replace the JSON by whatever you want to insert in the given table):

$ ts-node ./cli-sample.ts -b BEARER -d DOC_ID -t TABLE_ID -u http://localhost:8484/api --recordToAdd '{"Name": "Some-Name", "Email": "[email protected]"}'

How does this work?

Openapi-typescript-codegen parses the content of the yaml file and generates a client and the models to pass to the Client so it can handle the requests.