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

37
get-bases.go Normal file
View File

@@ -0,0 +1,37 @@
package airtable
import (
"net/url"
)
// GetBasesConfig helper type to use in.
// step by step get bases.
type GetBasesConfig struct {
client *Client
params url.Values
}
// GetBases prepare step to get bases.
func (c *Client) GetBases() *GetBasesConfig {
return &GetBasesConfig{
client: c,
params: url.Values{},
}
}
// Pagination
// The server returns one page of bases at a time.
// If there are more records, the response will contain an offset.
// To fetch the next page of records, include offset in the next request's parameters.
// WithOffset Pagination will stop when you've reached the end of your bases.
func (gbc *GetBasesConfig) WithOffset(offset string) *GetBasesConfig {
gbc.params.Set("offset", offset)
return gbc
}
// Do send the prepared get records request.
func (gbc *GetBasesConfig) Do() (*Bases, error) {
return gbc.client.GetBasesWithParams(gbc.params)
}