Start here
Grist Go preview
Unofficial Octri preview. Three operations from Grist's public API schema: list document tables, list filtered records, and replace records against a local mock only. This is a generic document client. Record fields remain map[string]any; it does not create typed Go fields for each customer's columns.
Install and configure
Download generated Go SDK. Unzip to use as a Go module; this ZIP is not a published registry release. The public source labels API version 1.0.1.
package main
import (
"context"
"fmt"
"os"
grist "github.com/grist_octri_preview_sdk/sdk"
)
func main() {
client := grist.NewGristOctriPreview(grist.ClientConfig{
BaseURL: "https://docs.getgrist.com/api", // Set your own team or self-hosted API URL.
Auth: &grist.ClientAuthConfig{ApiKey: os.Getenv("GRIST_API_KEY")},
})
tables, err := client.Tables.List(context.Background(), grist.ListTablesParams{DocId: "your-document-id"})
if err != nil { panic(err) }
fmt.Println(tables.Tables[0].Id)
filter := `{"Status":["Open"]}` // JSON string; SDK URL-encodes query value.
records, err := client.Records.List(context.Background(), grist.ListRecordsParams{
DocId: "your-document-id", TableId: "YourTable", Filter: &filter,
})
if err != nil { panic(err) }
fmt.Println(records.Records[0].Fields["Status"])
}Mock-only upsert
client.Records.Replace sends PUT /docs/{docId}/tables/{tableId}/records. It can write real data. Example below targets a local mock and synthetic values only.
client := grist.NewGristOctriPreview(grist.ClientConfig{
BaseURL: "http://127.0.0.1:4010/api",
Auth: &grist.ClientAuthConfig{ApiKey: "synthetic-key"},
})
_, err := client.Records.Replace(context.Background(), grist.ReplaceRecordsParams{
DocId: "demo-doc", TableId: "People",
Records: []grist.RecordsWithRequireRecords{{
Require: map[string]any{"Name": "Ada"},
Fields: map[string]any{"Score": 10},
}},
})Tested scope and limits
Downloaded SDK passed go test -v ./... against four synthetic local HTTP requests: bearer API key, custom base URL, JSON filter URL encoding, dynamic record fields, mock-only upsert body, and typed 401. No live Grist document was read or changed. Spec's server variable name was inconsistent; demo copy uses Grist personal-site API URL, with custom base URL for other instances. No automatic spec sync configured or tested.