Files
airtable/record.go

34 lines
687 B
Go
Raw Normal View History

package airtable
import (
"context"
2024-06-22 21:46:58 -07:00
"fmt"
)
type Record struct {
2023-07-09 22:33:45 +05:00
ID string `json:"id,omitempty"`
Fields map[string]any `json:"fields"`
CreatedTime string `json:"createdTime,omitempty"`
Deleted bool `json:"deleted,omitempty"`
2021-02-05 22:46:27 +03:00
2024-06-22 21:46:58 -07:00
c *Client
b *Base
t *Table
}
2024-06-22 21:46:58 -07:00
type ListRecordOptions struct {
}
2024-06-22 21:46:58 -07:00
func (t *Table) ListRecords(ctx context.Context, opts *ListRecordOptions) ([]*Record, error) {
return listAll[Record](ctx, t.c, fmt.Sprintf("%s/%s", t.b.ID, t.ID), nil, "records", func(r *Record) error {
r.c = t.c
r.b = t.b
r.t = t
return nil
})
}
2024-06-22 21:46:58 -07:00
func (r Record) String() string {
return r.Fields[r.t.Fields[0].Name].(string)
}