Documentation
¶
Index ¶
- Variables
- func FromDateTime(t time.Time) any
- func ToDateTime(field any) (time.Time, error)
- type Attachment
- type Base
- type BaseConfig
- type Bases
- type Client
- func (c *Client) GetBaseSchema(dbId string) *BaseConfig
- func (c *Client) GetBases() *GetBasesConfig
- func (at *Client) GetBasesWithParams(params url.Values) (*Bases, error)
- func (at *Client) GetBasesWithParamsContext(ctx context.Context, params url.Values) (*Bases, error)
- func (c *Client) GetTable(dbName, tableName string) *Table
- func (at *Client) SetBaseURL(baseURL string) error
- func (at *Client) SetCustomClient(client *http.Client)
- func (at *Client) SetRateLimit(customRateLimit int)
- type Field
- type FieldAttachmentDetails
- type FieldAttachments
- type GetBasesConfig
- type GetRecordsConfig
- func (grc *GetRecordsConfig) Do() (*Records, error)
- func (grc *GetRecordsConfig) DoContext(ctx context.Context) (*Records, error)
- func (grc *GetRecordsConfig) FromView(viewNameOrID string) *GetRecordsConfig
- func (grc *GetRecordsConfig) InStringFormat(timeZone, userLocale string) *GetRecordsConfig
- func (grc *GetRecordsConfig) MaxRecords(maxRecords int) *GetRecordsConfig
- func (grc *GetRecordsConfig) PageSize(pageSize int) *GetRecordsConfig
- func (grc *GetRecordsConfig) ReturnFields(fieldNames ...string) *GetRecordsConfig
- func (grc *GetRecordsConfig) WithFieldsById() *GetRecordsConfig
- func (grc *GetRecordsConfig) WithFilterFormula(filterFormula string) *GetRecordsConfig
- func (grc *GetRecordsConfig) WithOffset(offset string) *GetRecordsConfig
- func (grc *GetRecordsConfig) WithSort(sortQueries ...) *GetRecordsConfig
- type HTTPClientError
- type PerformUpsert
- type Record
- func (r *Record) DeleteRecord() (*Record, error)
- func (r *Record) DeleteRecordContext(ctx context.Context) (*Record, error)
- func (r *Record) UpdateRecordPartial(changedFields map[string]any) (*Record, error)
- func (r *Record) UpdateRecordPartialContext(ctx context.Context, changedFields map[string]any) (*Record, error)
- type Records
- type Table
- func (t *Table) AddRecords(records *Records) (*Records, error)
- func (t *Table) AddRecordsContext(ctx context.Context, records *Records) (*Records, error)
- func (t *Table) DeleteRecords(recordIDs []string) (*Records, error)
- func (t *Table) DeleteRecordsContext(ctx context.Context, recordIDs []string) (*Records, error)
- func (t *Table) GetRecord(recordID string) (*Record, error)
- func (t *Table) GetRecordContext(ctx context.Context, recordID string) (*Record, error)
- func (t *Table) GetRecords() *GetRecordsConfig
- func (t *Table) GetRecordsWithParams(params url.Values) (*Records, error)
- func (t *Table) GetRecordsWithParamsContext(ctx context.Context, params url.Values) (*Records, error)
- func (t *Table) UpdateRecords(records *Records) (*Records, error)
- func (t *Table) UpdateRecordsContext(ctx context.Context, records *Records) (*Records, error)
- func (t *Table) UpdateRecordsPartial(records *Records) (*Records, error)
- func (t *Table) UpdateRecordsPartialContext(ctx context.Context, records *Records) (*Records, error)
- func (t *Table) UploadAttachment(recordID string, attachmentFieldIdOrName string, data Attachment) (*FieldAttachments, error)
- func (t *Table) UploadAttachmentContext(ctx context.Context, recordID string, attachmentFieldIdOrName string, ...) (*FieldAttachments, error)
- type TableSchema
- type Tables
- type View
Constants ¶
This section is empty.
Variables ¶
var ErrNotDateTime = errors.New("field is not date time")
Functions ¶
func FromDateTime ¶ added in v0.2.7
Types ¶
type Attachment ¶ added in v0.3.3
type Base ¶ added in v0.2.8
type Base struct { ID string `json:"id"` Name string `json:"name"` PermissionLevel string `json:"permissionLevel"` }
Base type of airtable base.
type BaseConfig ¶ added in v0.2.8
type BaseConfig struct {
// contains filtered or unexported fields
}
Table represents table object.
func (*BaseConfig) Do ¶ added in v0.2.8
func (b *BaseConfig) Do() (*Tables, error)
Do send the prepared
func (*BaseConfig) DoContext ¶ added in v0.3.1
func (b *BaseConfig) DoContext(ctx context.Context) (*Tables, error)
Do send the prepared with custom context
func (*BaseConfig) GetTables ¶ added in v0.3.1
func (b *BaseConfig) GetTables() (*Tables, error)
GetTables get tables from a base with url values params https://airtable.com/developers/web/api/get-base-schema
func (*BaseConfig) GetTablesContext ¶ added in v0.3.1
func (b *BaseConfig) GetTablesContext(ctx context.Context) (*Tables, error)
getTablesContext get tables from a base with url values params with custom context
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client client for airtable api.
func NewClient ¶
NewClient airtable client constructor your API KEY you can get on your account page https://airtable.com/account
func (*Client) GetBaseSchema ¶ added in v0.2.8
func (c *Client) GetBaseSchema(dbId string) *BaseConfig
GetBase return Base object.
func (*Client) GetBases ¶ added in v0.2.8
func (c *Client) GetBases() *GetBasesConfig
GetBases prepare step to get bases.
func (*Client) GetBasesWithParams ¶ added in v0.2.8
GetBasesWithParams get bases with url values params https://airtable.com/developers/web/api/list-bases
func (*Client) GetBasesWithParamsContext ¶ added in v0.3.1
getBasesWithParamsContext get bases with url values params with custom context
func (*Client) SetBaseURL ¶ added in v0.2.5
func (*Client) SetCustomClient ¶ added in v0.3.1
Set custom http client for custom usage
func (*Client) SetRateLimit ¶
SetRateLimit rate limit setter for custom usage Airtable limit is 5 requests per second (we use 4) https://airtable.com/{yourDatabaseID}/api/docs#curl/ratelimits
type FieldAttachmentDetails ¶ added in v0.3.3
type FieldAttachments ¶ added in v0.3.3
type FieldAttachments struct { // Parent record's ID of the attached file. Id string `json:"id"` CreatedTime string `json:"createdTime"` // Mapped array of attachments attached to this field. // // Key is the ID of the record's attachment field and the value is the list of attached files. Attachments map[string][]FieldAttachmentDetails `json:"fields"` // contains filtered or unexported fields }
type GetBasesConfig ¶ added in v0.2.8
type GetBasesConfig struct {
// contains filtered or unexported fields
}
GetBasesConfig helper type to use in. step by step get bases.
func (*GetBasesConfig) Do ¶ added in v0.2.8
func (gbc *GetBasesConfig) Do() (*Bases, error)
Do send the prepared get records request.
func (*GetBasesConfig) DoContext ¶ added in v0.3.2
func (gbc *GetBasesConfig) DoContext(ctx context.Context) (*Bases, error)
DoContext send the prepared get records request with context.
func (*GetBasesConfig) WithOffset ¶ added in v0.2.8
func (gbc *GetBasesConfig) WithOffset(offset string) *GetBasesConfig
WithOffset Pagination will stop when you've reached the end of your bases.
type GetRecordsConfig ¶
type GetRecordsConfig struct {
// contains filtered or unexported fields
}
GetRecordsConfig helper type to use in. step by step get records.
func (*GetRecordsConfig) Do ¶
func (grc *GetRecordsConfig) Do() (*Records, error)
Do send the prepared get records request.
func (*GetRecordsConfig) DoContext ¶ added in v0.3.2
func (grc *GetRecordsConfig) DoContext(ctx context.Context) (*Records, error)
DoContext send the prepared get records request with context.
func (*GetRecordsConfig) FromView ¶
func (grc *GetRecordsConfig) FromView(viewNameOrID string) *GetRecordsConfig
FromView add view parameter to get records.
func (*GetRecordsConfig) InStringFormat ¶
func (grc *GetRecordsConfig) InStringFormat(timeZone, userLocale string) *GetRecordsConfig
InStringFormat add parameter to get records in string format. it require timezone https://support.airtable.com/hc/en-us/articles/216141558-Supported-timezones-for-SET-TIMEZONE and user locale data https://support.airtable.com/hc/en-us/articles/220340268-Supported-locale-modifiers-for-SET-LOCALE
func (*GetRecordsConfig) MaxRecords ¶ added in v0.2.0
func (grc *GetRecordsConfig) MaxRecords(maxRecords int) *GetRecordsConfig
MaxRecords The maximum total number of records that will be returned in your requests. If this value is larger than pageSize (which is 100 by default), you may have to load multiple pages to reach this total. See the Pagination section below for more.
func (*GetRecordsConfig) PageSize ¶ added in v0.2.0
func (grc *GetRecordsConfig) PageSize(pageSize int) *GetRecordsConfig
PageSize The number of records returned in each request. Must be less than or equal to 100. Default is 100. See the Pagination section below for more.
func (*GetRecordsConfig) ReturnFields ¶
func (grc *GetRecordsConfig) ReturnFields(fieldNames ...string) *GetRecordsConfig
ReturnFields set returning field names.
func (*GetRecordsConfig) WithFieldsById ¶ added in v0.3.4
func (grc *GetRecordsConfig) WithFieldsById() *GetRecordsConfig
WithFieldsById returns the Record fields by field ID instead of names.
func (*GetRecordsConfig) WithFilterFormula ¶
func (grc *GetRecordsConfig) WithFilterFormula(filterFormula string) *GetRecordsConfig
WithFilterFormula add filter to request.
func (*GetRecordsConfig) WithOffset ¶ added in v0.2.0
func (grc *GetRecordsConfig) WithOffset(offset string) *GetRecordsConfig
WithOffset Pagination will stop when you've reached the end of your table. If the maxRecords parameter is passed, pagination will stop once you've reached this maximum.
func (*GetRecordsConfig) WithSort ¶
func (grc *GetRecordsConfig) WithSort(sortQueries ...struct { FieldName string Direction string }, ) *GetRecordsConfig
WithSort add sorting to request.
type HTTPClientError ¶
HTTPClientError custom error to handle with response status.
func (*HTTPClientError) Error ¶
func (e *HTTPClientError) Error() string
type PerformUpsert ¶ added in v0.3.3
type PerformUpsert struct {
FieldsToMergeOn []string `json:"fieldsToMergeOn"`
}
type Record ¶
type Record struct { ID string `json:"id,omitempty"` Fields map[string]any `json:"fields"` CreatedTime string `json:"createdTime,omitempty"` Deleted bool `json:"deleted,omitempty"` // The Airtable API will perform best-effort automatic data conversion // from string values if the typecast parameter is passed in. // Automatic conversion is disabled by default to ensure data integrity, // but it may be helpful for integrating with 3rd party data sources. Typecast bool `json:"typecast,omitempty"` // contains filtered or unexported fields }
Record base time of airtable record fields.
func (*Record) DeleteRecord ¶
DeleteRecord delete one record.
func (*Record) DeleteRecordContext ¶ added in v0.3.1
DeleteRecordContext delete one record with custom context
func (*Record) UpdateRecordPartial ¶
UpdateRecordPartial updates partial info on record.
type Records ¶
type Records struct { Records []*Record `json:"records"` Offset string `json:"offset,omitempty"` // The Airtable API will perform best-effort automatic data conversion // from string values if the typecast parameter is passed in. // Automatic conversion is disabled by default to ensure data integrity, // but it may be helpful for integrating with 3rd party data sources. Typecast bool `json:"typecast,omitempty"` // fieldsToMergeOn will be used as an external ID to match records for updates. // For records where no match is found, a new Airtable record will be created. // https://airtable.com/developers/web/api/update-multiple-records#request-performupsert PerformUpsert *PerformUpsert `json:"performUpsert,omitempty"` }
Records base type of airtable records.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents table object.
func (*Table) AddRecords ¶
AddRecords method to add lines to table (up to 10 in one request) https://airtable.com/{yourDatabaseID}/api/docs#curl/table:{yourTableName}:create
func (*Table) AddRecordsContext ¶ added in v0.3.1
AddRecordsContext method to add lines to table (up to 10 in one request) with custom context
func (*Table) DeleteRecords ¶
DeleteRecords delete records by recordID up to 10 ids in one request.
func (*Table) DeleteRecordsContext ¶ added in v0.3.1
DeleteRecordsContext delete records by recordID with custom context
func (*Table) GetRecord ¶
GetRecord get record from table https://airtable.com/{yourDatabaseID}/api/docs#curl/table:{yourTableName}:retrieve
func (*Table) GetRecordContext ¶ added in v0.3.1
GetRecordContext get record from table with custom context
func (*Table) GetRecords ¶
func (t *Table) GetRecords() *GetRecordsConfig
GetRecords prepare step to get records.
func (*Table) GetRecordsWithParams ¶
GetRecordsWithParams get records with url values params https://airtable.com/{yourDatabaseID}/api/docs#curl/table:{yourTableName}:list
func (*Table) GetRecordsWithParamsContext ¶ added in v0.3.1
func (t *Table) GetRecordsWithParamsContext(ctx context.Context, params url.Values) (*Records, error)
GetRecordsWithParamsContext get records with url values params with custom context
func (*Table) UpdateRecords ¶
UpdateRecords full update records.
func (*Table) UpdateRecordsContext ¶ added in v0.3.1
UpdateRecordsContext full update records with custom context.
func (*Table) UpdateRecordsPartial ¶ added in v0.2.0
UpdateRecordsPartial partial update records.
func (*Table) UpdateRecordsPartialContext ¶ added in v0.3.1
func (t *Table) UpdateRecordsPartialContext(ctx context.Context, records *Records) (*Records, error)
UpdateRecordsPartialContext partial update records with custom context.
func (*Table) UploadAttachment ¶ added in v0.3.3
func (t *Table) UploadAttachment(recordID string, attachmentFieldIdOrName string, data Attachment) (*FieldAttachments, error)
func (*Table) UploadAttachmentContext ¶ added in v0.3.3
func (t *Table) UploadAttachmentContext(ctx context.Context, recordID string, attachmentFieldIdOrName string, data Attachment) (*FieldAttachments, error)
type TableSchema ¶ added in v0.2.8
type Tables ¶ added in v0.2.8
type Tables struct {
Tables []*TableSchema `json:"tables"`
}