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
base_test.go Normal file
View File

@@ -0,0 +1,25 @@
package airtable
import (
"testing"
)
func TestGetBaseSchema(t *testing.T) {
client := testClient(t)
baseschema := client.GetBaseSchema("test")
baseschema.client.baseURL = mockResponse("base_schema.json").URL
result, err := baseschema.Do()
if err != nil {
t.Errorf("there should not be an err, but was: %v", err)
}
if len(result.Tables) != 2 {
t.Errorf("there should be 2 tales, but was %v", len(result.Tables))
}
baseschema.client.baseURL = mockErrorResponse(400).URL
_, err = baseschema.Do()
if err == nil {
t.Errorf("there should be an err, but was nil")
}
}