feat: add read-only support of the meta API (#13)

* Add bases API.

* Implement get tables schema

* Rename GetBase to GetBaseSchema

* Add tests

* Update doc
This commit is contained in:
François de Metz
2023-01-01 15:18:29 +01:00
committed by GitHub
parent 6275e61012
commit 1b1e6e9e92
7 changed files with 275 additions and 0 deletions

25
get-bases_test.go Normal file
View File

@@ -0,0 +1,25 @@
package airtable
import (
"testing"
)
func TestGetBases_Do(t *testing.T) {
client := testClient(t)
bases := client.GetBases()
bases.client.baseURL = mockResponse("get_bases.json").URL
result, err := bases.WithOffset("0").Do()
if err != nil {
t.Errorf("there should not be an err, but was: %v", err)
}
if len(result.Bases) != 2 {
t.Errorf("there should be 2 bases, but was %v", len(result.Bases))
}
bases.client.baseURL = mockErrorResponse(400).URL
_, err = bases.Do()
if err == nil {
t.Errorf("there should be an err, but was nil")
}
}